I am trying to use a ContainerBinding to bind to the Canvas.Left and Canvas.Top attached properties. Here is an example:
The Width and Height bindings in the ContainerBinding collection are working fine, but the Canvas.Left and Canvas.Top bindings are not working.
Can anyone tell me how to get this working?
<telerik:ItemsControl ItemsSource="{Binding Parts}"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Width="500"
Height="500">
<telerik:ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<Canvas>
<Canvas.Background>
<SolidColorBrush Color="White" />
</Canvas.Background>
</Canvas>
</ItemsPanelTemplate>
</telerik:ItemsControl.ItemsPanel>
<!--setup container bindings... temp workaround for inability to do setter bindings in SL-->
<telerik:ItemsControl.ItemTemplate>
<DataTemplate>
<telerik:ContainerBinding.ContainerBindings>
<telerik:ContainerBindingCollection x:Name="ContainerBindings">
<telerik:ContainerBinding PropertyName="(Canvas.Left)"
Binding="{Binding X}" />
<telerik:ContainerBinding PropertyName="(Canvas.Top)"
Binding="{Binding Y}" />
<telerik:ContainerBinding PropertyName="Width"
Binding="{Binding Width}" />
<telerik:ContainerBinding PropertyName="Height"
Binding="{Binding Height}" />
</telerik:ContainerBindingCollection>
</telerik:ContainerBinding.ContainerBindings>
<Grid Background="Orange"/>
</DataTemplate>
</telerik:ItemsControl.ItemTemplate>
</telerik:ItemsControl>
The Width and Height bindings in the ContainerBinding collection are working fine, but the Canvas.Left and Canvas.Top bindings are not working.
Can anyone tell me how to get this working?