-
Notifications
You must be signed in to change notification settings - Fork 17
Home
Mircea Staicu edited this page Jul 12, 2021
·
18 revisions
Install-Package RichCanvas
Decalre the namespace: clr-namespace:RichCanvas;assembly=RichCanvas
Use the following XAML:
<richcanvas:RichItemsControl></richcanvas:RichItemsControl>
Now you have a canvas with panning, zooming, scrolling and selecting.
<richCanvas:RichItemsControl ItemsSource="{Binding Items}">
<richCanvas:RichItemsControl.Resources>
<DataTemplate DataType="{x:Type vm:Rectangle}">
<Rectangle Fill="Red"></Rectangle>
</DataTemplate>
</richCanvas:RichItemsControl.Resources>
<richCanvas:RichItemsControl.ItemContainerStyle>
<Style TargetType="richCanvas:RichItemContainer">
<Setter Property="Top"
Value="{Binding Top, Mode=TwoWay}" />
<Setter Property="Left"
Value="{Binding Left, Mode=TwoWay}" />
<Setter Property="Width"
Value="{Binding Width, Mode=TwoWay}" />
<Setter Property="Height"
Value="{Binding Height, Mode=TwoWay}" />
</Style>
</richCanvas:RichItemsControl.ItemContainerStyle>
</richCanvas:RichItemsControl>