I am developing an UserControl in XAML consisting of an image of the human body, where some electrode position points are to be specified.
Each position would be modeled by some datatype containing properties for Position, Orientation (angle) and State (enabled, disabled, activated):
I want to use sample data (DataProvider or something similar) defined directly in XAML so I can design position and orientation visually and try some different possibilities by editing the single XAML file and having immediate visual feedback.
So I will create an ItemsControl with a Canvas, define a DataTemplate for my objects, and then I would like to write something similar to this XAML:
<ItemsControl x:Name="DotsOverBody"
ItemsSource="{StaticResource SomeLocalXamlDefinedDataSource}"
ItemTemplate="{StaticResource SomeSuitableTemplate}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<Canvas IsItemsHost="True" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<!-- Could I define a generic (xml-based?) "Body Position" type
directly in XAML? -->
<BodyPosition X="123" Y="456" Angle="45"/>
<BodyPosition X="133" Y="476" Angle="33"/>
<BodyPosition X="125" Y="356" Angle="77"/>
<BodyPosition X="323" Y="457" Angle="89"/>
<BodyPosition X="528" Y="426" Angle="10"/>
<BodyPosition X="163" Y="156" Angle="3"/>
</ItemsControl>
A screenshot of a legacy application we have is below, with my intended visual output (I already have a DataTemplate for that, which I would change the target type of course).
So how could I achieve this?