In the usercontrol TimeTableView.xaml there is a child usercontrol of type ViewControl. Via a slider in TimeTableView I wish to affect the size of a grid in the ViewControl. Following similar SO questions I've put a DependencyProperty on the ViewControl and bound that within both usercontrols. However, I get a binding error pertaining to the binding in ViewControl: "ZoomValue Property not found on object of type ViewControl" Must be a silly error somewhere, but where is it? I've tried variation on this for example ...ScaleX="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:ViewControl}}...
but same problem
TimeTableView.xaml
...
<Slider Name="Slider" Minimum="0.5" Maximum="2" Value="1" Width="100"/>
...
<local:ViewControl x:Name="MainSectionView" DataContext="{Binding Path=MainViewDataContext}"
local:ZoomHost.ZoomValue="{Binding ElementName=Slider, Path=Value}"/>
...
ViewControl.xaml
...
...
<Grid>
<Grid.RenderTransform>
<ScaleTransform ScaleX="{Binding RelativeSource={RelativeSource AncestorType={x:Type UserControl}}, Path=ZoomValue}"></ScaleTransform>
</Grid.RenderTransform>
...
</Grid>
ZoomHost
public class ZoomHost
{
public static readonly DependencyProperty ZoomValueProperty =
DependencyProperty.RegisterAttached("ZoomValue", typeof(float), typeof(ZoomHost));
public static float GetZoomValue(ViewControl vwc)
{
return (float)vwc.GetValue(ZoomValueProperty);
}
public static void SetZoomValue(ViewControl vwc, float value)
{
vwc.SetValue(ZoomValueProperty, value);
}
}