
Untitled
By: a guest on
May 7th, 2012 | syntax:
None | size: 0.96 KB | hits: 11 | expires: Never
UserControl with List<T> property - any chance for declarative definition?
public List<Rect> HotSpots
{
get { return (List<Rect>)GetValue(HotSpotsProperty); }
set { SetValue(HotSpotsProperty, value); }
}
public static readonly DependencyProperty HotSpotsProperty =
DependencyProperty.Register("HotSpots", typeof(List<Rect>), typeof(ImageViewPort), new FrameworkPropertyMetadata(HotSpotsChanged));
<WPF:ImageViewPort Grid.Row="1">
<WPF:ImageViewPort.HotSpots>
<Rect Location="0,0" Height="30" Width="50"></Rect>
<Rect Location="10,35" Height="30" Width="20"></Rect>
</WPF:ImageViewPort.HotSpots>
</WPF:ImageViewPort>
<WPF:ImageViewPort Grid.Row="1" HotSpots="{Binding Path=HotSpots}"/>
public class HotSpotList : List<Rect> {}
<WPF:ImageViewPort.HotSpots>
<HotSpotList>
<Rect Location="0,0" Height="30" Width="50"></Rect>
<Rect Location="10,35" Height="30" Width="20"></Rect>
</HotSpotList>
</WPF:ImageViewPort.HotSpots>