Skip to content

Commit d88986d

Browse files
MainWindow_added
1 parent 01ef3b7 commit d88986d

1 file changed

Lines changed: 150 additions & 0 deletions

File tree

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
<Window x:Class="GroupSnapping.MainWindow"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6+
xmlns:local="clr-namespace:GroupSnapping"
7+
xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
8+
xmlns:System="clr-namespace:System;assembly=mscorlib"
9+
mc:Ignorable="d"
10+
Title="Group Snapping Sample - SfDiagram" Height="700" Width="1200"
11+
WindowStartupLocation="CenterScreen">
12+
<Window.Resources>
13+
<ResourceDictionary>
14+
<ResourceDictionary.MergedDictionaries>
15+
<ResourceDictionary Source="/Syncfusion.SfDiagram.Wpf;component/Resources/BasicShapes.xaml"/>
16+
</ResourceDictionary.MergedDictionaries>
17+
18+
<Style TargetType="syncfusion:Node">
19+
<Setter Property="ShapeStyle">
20+
<Setter.Value>
21+
<Style TargetType="Path">
22+
<Setter Property="Fill" Value="#FF5B9BD5"/>
23+
<Setter Property="Stretch" Value="Fill"/>
24+
<Setter Property="Stroke" Value="#FFEDF1F6 "/>
25+
</Style>
26+
</Setter.Value>
27+
</Setter>
28+
</Style>
29+
30+
<Style TargetType="syncfusion:NodePort">
31+
<Setter Property="Shape">
32+
<Setter.Value>
33+
<RectangleGeometry Rect="0,0,10,10"/>
34+
</Setter.Value>
35+
</Setter>
36+
<Setter Property="ShapeStyle">
37+
<Setter.Value>
38+
<Style TargetType="Path">
39+
<Setter Property="Stretch" Value="Fill"/>
40+
<Setter Property="Fill" Value="#FF808081"/>
41+
</Style>
42+
</Setter.Value>
43+
</Setter>
44+
</Style>
45+
46+
47+
<ObjectDataProvider x:Key="SnapToObject" MethodName="GetValues" ObjectType="{x:Type System:Enum}" >
48+
<ObjectDataProvider.MethodParameters>
49+
<x:Type TypeName="syncfusion:SnapToObject"/>
50+
</ObjectDataProvider.MethodParameters>
51+
</ObjectDataProvider>
52+
<local:ColorToBrushConverter x:Key="ColorToBrushConverter"/>
53+
54+
</ResourceDictionary>
55+
</Window.Resources>
56+
57+
58+
<Window.DataContext>
59+
<local:SnappingViewModel/>
60+
</Window.DataContext>
61+
62+
63+
<Grid>
64+
<Grid.ColumnDefinitions>
65+
<ColumnDefinition Width="*"/>
66+
<ColumnDefinition Width="350"/>
67+
</Grid.ColumnDefinitions>
68+
69+
<!--Properties Panel Labels-->
70+
<Border x:Name="propertyPanel" Grid.Column="1" Background="#F4F4F4">
71+
<StackPanel Margin="20,20,20,0" >
72+
<Label Content="Properties" BorderBrush="Transparent" FontSize="18" FontFamily="Segoe UI"
73+
Foreground="Black" FontWeight="Bold" Margin="0,0,10,0" Height="32"/>
74+
<Rectangle HorizontalAlignment="Stretch" Fill="#dddddd" Height="1.3"
75+
Grid.Row="1" Grid.Column="1" Margin="7,5,10,0"></Rectangle>
76+
<CheckBox x:Name="showGridlines" Margin="15,15,0,0"
77+
FontSize="15" Command="{Binding ShowGridlinesCommand, Mode=TwoWay}"
78+
CommandParameter="{Binding IsChecked, ElementName=showGridlines}"
79+
Content="Show Gridlines" IsChecked="True" >
80+
</CheckBox>
81+
<CheckBox x:Name="snappingToGridlines" Margin="15,15,0,10"
82+
FontSize="15"
83+
Command="{Binding SnappingToGridlinesCommand, Mode=TwoWay}"
84+
CommandParameter="{Binding IsChecked, ElementName=snappingToGridlines}"
85+
Content="Snapping To Gridlines" IsChecked="True" >
86+
</CheckBox>
87+
<CheckBox x:Name="EnableSnapping" Margin="15,15,0,10"
88+
FontSize="15" Grid.Row="0" Grid.Column="0"
89+
90+
Content="Enable Snapping" IsChecked="{Binding IsSnappingEnabled, Mode=TwoWay}" />
91+
<Grid>
92+
<Grid.ColumnDefinitions>
93+
<ColumnDefinition Width="160"/>
94+
<ColumnDefinition Width="140"/>
95+
</Grid.ColumnDefinitions>
96+
97+
<Grid.RowDefinitions>
98+
<RowDefinition/>
99+
<RowDefinition/>
100+
<RowDefinition/>
101+
<RowDefinition/>
102+
<RowDefinition/>
103+
<RowDefinition/>
104+
<RowDefinition/>
105+
</Grid.RowDefinitions>
106+
107+
108+
109+
<Label Margin="10,5,0,0" Grid.Row="1" Grid.Column="0"
110+
Background="Transparent" BorderBrush="Transparent" FontSize="15"
111+
Foreground="Black" Content="Snapping Interval"/>
112+
<Label Margin="10,5,0,0" Grid.Row="2" Grid.Column="0"
113+
Background="Transparent" BorderBrush="Transparent" FontSize="15"
114+
Foreground="Black" Content="Snapping Angle"/>
115+
<Label Margin="10,5,0,0" Grid.Row="3" Grid.Column="0"
116+
Background="Transparent" BorderBrush="Transparent" FontSize="15"
117+
Foreground="Black" Content="Snapping Line Color"/>
118+
<Label Margin="10,5,0,0" Grid.Row="4" Grid.Column="0"
119+
Background="Transparent" BorderBrush="Transparent" FontSize="15"
120+
Foreground="Black" Content="Line Thickness"/>
121+
<Label Margin="10,5,0,0" Grid.Row="5" Grid.Column="0"
122+
Background="Transparent" BorderBrush="Transparent" FontSize="15"
123+
Foreground="Black" Content="SnapToObject"/>
124+
125+
<syncfusion:UpDown Margin="0,10,0,10" Grid.Row="1" Grid.Column="1"
126+
Value="{Binding SnapIntervalChanged, Mode=TwoWay}" />
127+
<syncfusion:UpDown Margin="0,10,0,10" Grid.Row="2" Grid.Column="1"
128+
Value="{Binding ElementName=diagram , Path=DataContext.SnapAngleChanged, Mode=TwoWay}" />
129+
<syncfusion:ColorPickerPalette Margin="0,10,0,10" Grid.Row="3" Grid.Column="1" HorizontalAlignment="Left"
130+
Width="60" Height="25"
131+
Color="{Binding ElementName=diagram, Path=DataContext.Strokecolor, Mode=TwoWay, Converter={StaticResource ColorToBrushConverter}}" />
132+
<syncfusion:UpDown Margin="0,10,0,10" Grid.Row="4" Grid.Column="1"
133+
Value="{Binding ElementName=diagram , Path=DataContext.Strokethickness, Mode=TwoWay}"
134+
FontSize="11pt" FontFamily="Segoe UI" Foreground="Black" FontWeight="Bold"/>
135+
<ComboBox x:Name="snapToObject" SelectedIndex="22" Margin="0,10,0,10" Grid.Row="5" Grid.Column="1"
136+
ItemsSource="{Binding Source={StaticResource SnapToObject}}"
137+
SelectedItem="{Binding SnapToObjectValue}"/>
138+
</Grid>
139+
</StackPanel>
140+
</Border>
141+
<syncfusion:SfDiagram x:Name="diagram" Grid.Column="0" PortVisibility="Visible"
142+
143+
HorizontalRuler="{Binding HorizontalRuler}"
144+
VerticalRuler="{Binding VerticalRuler}"
145+
146+
SnapSettings="{Binding SnapSettings}"
147+
SelectedItems="{Binding SelectedItems}">
148+
</syncfusion:SfDiagram>
149+
</Grid>
150+
</Window>

0 commit comments

Comments
 (0)