I'm attempting to bind to a readonly property on a third party control (so no control over the implementation of the property). As I understand, I need to do this as a onewaytosource binding type, and also need to do it in code.
I have the following code to set the binding:
Binding svBinding = new Binding();
svBinding.Path = new PropertyPath("SurfaceScrollViewer");
svBinding.Source = DataContext;
svBinding.Mode = BindingMode.OneWayToSource;
Ds.SetBinding(DiagramSurface.ScrollViewerProperty, svBinding);
And my property implementation on the view model:
public DiagramScrollViewer SurfaceScrollViewer
{
get
{
return surfaceScrollViewer;
}
set
{
surfaceScrollViewer = value;
}
}
private DiagramScrollViewer surfaceScrollViewer;
I can access other properties in the same data context by code, but for some reason, I cannot get this property to bind. Can anyone see where I'm going wrong?