Skip to content
Mircea Staicu edited this page Jul 12, 2021 · 18 revisions

Welcome to the RichCanvas wiki!

Table of contents

Requirements

IDE .NET C#

Install RichCanvas from Nuget

Download Package

Install-Package RichCanvas

Application example

Quick start

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.

Common XAML structure for MVVM:

<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>