This is a simple case, that I am having difficulty understanding nesting types in xaml. Say you have a myusercontrol.xaml
and you want to declarativly pass data to it like this:
<my:MyUserControl x:Name="myUserControl1" >
<my:PointCollection>
<my:point>33,12</my:point>
<my:point>11,12</my:point>
</my:PointCollection>
<my:PointCollection>
<my:point>33,12</my:point>
<my:point>11,12</my:point>
</my:PointCollection>
</my:MyUserControl>
What would MyUserControl.xaml/.cs have to look like to accept this Enumeration of Point collection dependency.
Second question would be, how do i reform开发者_C百科ulate the xaml usage above so that i can databind to a Enumerable to myUserControl1.DataContext.
For databinding to an enumerable, use a Collection View. See the Remarks and Examples sections.
<MyUserControl.DataContext>
<Binding Source="{StaticResource pointCollection}"/>
</MyUserControl.DataContext>
精彩评论