Assume that I have the ItemSource bound and i am getting the data. Now what I want is this. The ItemSource will contain Data that tells where each button should be. For Example: The first Button could be at Left:200,Top:0, the Second could be Left:50 Top:20.
</ItemsControl.Resources>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<Controls:MatrixCanvas />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<item:CustomButton
Height="{Binding btnSize}"
Width="{Binding btnSize}"
Style="{Binding bbColor,Converter={StaticResource ButtonStyleConverter}}"
/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
protected override Size ArrangeOverride(Size finalSize)
{
foreach (var child in Children)
{
//The child
}
return base.ArrangeOverride(finalSize);
}
The Child however is not giving me access to the Item that I want. Is their a good solution for this? Am I going about this the wrong way? The reason I am doing it like this is because their can be buttons added dynamically, removed, some buttons will need to move around etc..