|
| 1 | +<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| 2 | + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| 3 | + xmlns:local="clr-namespace:UserInteraction_Stencil" |
| 4 | + xmlns:syncfusion="http://schemas.syncfusion.com/wpf" |
| 5 | + x:Class="UserInteraction_Stencil.MainWindow" |
| 6 | + xmlns:System="clr-namespace:System;assembly=mscorlib" |
| 7 | + xmlns:viewmodel="clr-namespace:UserInteraction_Stencil.Viewmodel" |
| 8 | + xmlns:Stencil="clr-namespace:Syncfusion.UI.Xaml.Diagram.Stencil;assembly=Syncfusion.SfDiagram.Wpf" |
| 9 | + xmlns:RulerControl="clr-namespace:Syncfusion.UI.Xaml.Diagram.Controls;assembly=Syncfusion.SfDiagram.Wpf" |
| 10 | + xmlns:diagram="clr-namespace:Syncfusion.UI.Xaml.Diagram;assembly=Syncfusion.SfDiagram.Wpf" |
| 11 | + Icon="App.ico" |
| 12 | + Title="Stencil" |
| 13 | + WindowState="Maximized" |
| 14 | + WindowStartupLocation="CenterScreen"> |
| 15 | + <Window.DataContext> |
| 16 | + <viewmodel:StencilViewModel> |
| 17 | + <!--To Represent HorizontalRuler,VerticalRuler--> |
| 18 | + <viewmodel:StencilViewModel.HorizontalRuler> |
| 19 | + <RulerControl:Ruler Orientation="Horizontal"/> |
| 20 | + </viewmodel:StencilViewModel.HorizontalRuler> |
| 21 | + |
| 22 | + <viewmodel:StencilViewModel.VerticalRuler> |
| 23 | + <RulerControl:Ruler Orientation="Vertical"/> |
| 24 | + </viewmodel:StencilViewModel.VerticalRuler> |
| 25 | + |
| 26 | + <!--Initializes PageSettings--> |
| 27 | + <viewmodel:StencilViewModel.PageSettings> |
| 28 | + <syncfusion:PageSettings PageBorderBrush="Transparent"/> |
| 29 | + </viewmodel:StencilViewModel.PageSettings> |
| 30 | + |
| 31 | + <!--Initializes Node--> |
| 32 | + <viewmodel:StencilViewModel.Nodes> |
| 33 | + <syncfusion:NodeCollection/> |
| 34 | + </viewmodel:StencilViewModel.Nodes> |
| 35 | + |
| 36 | + <!--Initializes Connector--> |
| 37 | + <viewmodel:StencilViewModel.Connectors> |
| 38 | + <syncfusion:ConnectorCollection/> |
| 39 | + </viewmodel:StencilViewModel.Connectors> |
| 40 | + |
| 41 | + <!--Initializes Group--> |
| 42 | + <viewmodel:StencilViewModel.Groups> |
| 43 | + <syncfusion:GroupCollection/> |
| 44 | + </viewmodel:StencilViewModel.Groups> |
| 45 | + |
| 46 | + </viewmodel:StencilViewModel> |
| 47 | + </Window.DataContext> |
| 48 | + <Window.Resources> |
| 49 | + <ResourceDictionary> |
| 50 | + <ResourceDictionary.MergedDictionaries> |
| 51 | + <!--Initialize Shapes--> |
| 52 | + <ResourceDictionary Source="/Syncfusion.SfDiagram.Wpf;component/Resources/BasicShapes.xaml" /> |
| 53 | + <ResourceDictionary Source="/Syncfusion.SfDiagram.Wpf;component/Resources/Bindingstyle.xaml" /> |
| 54 | + </ResourceDictionary.MergedDictionaries> |
| 55 | + <local:EnumDisplayNameConverter x:Key="EnumDisplayNameConverter"/> |
| 56 | + <!--Style for Node--> |
| 57 | + <Style TargetType="syncfusion:Node"> |
| 58 | + <Setter Property="ShapeStyle"> |
| 59 | + <Setter.Value> |
| 60 | + <Style TargetType="Path"> |
| 61 | + <Setter Property="Fill" Value="#FF5B9BD5"/> |
| 62 | + <Setter Property="Stroke" Value="#FFC8C8C8"/> |
| 63 | + <Setter Property="Stretch" Value="Fill"/> |
| 64 | + </Style> |
| 65 | + </Setter.Value> |
| 66 | + </Setter> |
| 67 | + </Style> |
| 68 | + <DataTemplate x:Key="TitleTemplate"> |
| 69 | + <TextBlock x:Name="HeaderText" Text="{Binding}" FontSize="15" FontWeight="SemiBold" Padding="0,0,0,8"> |
| 70 | + </TextBlock> |
| 71 | + </DataTemplate> |
| 72 | + <ObjectDataProvider x:Key="DisplayMode" MethodName="GetValues" ObjectType="{x:Type System:Enum}"> |
| 73 | + <ObjectDataProvider.MethodParameters> |
| 74 | + <x:Type TypeName="diagram:DisplayMode"/> |
| 75 | + </ObjectDataProvider.MethodParameters> |
| 76 | + </ObjectDataProvider> |
| 77 | + <ObjectDataProvider x:Key="SymbolGroupDisplayMode" MethodName="GetValues" ObjectType="{x:Type System:Enum}"> |
| 78 | + <ObjectDataProvider.MethodParameters> |
| 79 | + <x:Type TypeName="diagram:SymbolGroupDisplayMode"/> |
| 80 | + </ObjectDataProvider.MethodParameters> |
| 81 | + </ObjectDataProvider> |
| 82 | + <ObjectDataProvider x:Key="SymbolsDisplayMode" MethodName="GetValues" ObjectType="{x:Type System:Enum}"> |
| 83 | + <ObjectDataProvider.MethodParameters> |
| 84 | + <x:Type TypeName="diagram:SymbolsDisplayMode"/> |
| 85 | + </ObjectDataProvider.MethodParameters> |
| 86 | + </ObjectDataProvider> |
| 87 | + <ObjectDataProvider x:Key="SymbolSelectionMode" MethodName="GetValues" ObjectType="{x:Type System:Enum}"> |
| 88 | + <ObjectDataProvider.MethodParameters> |
| 89 | + <x:Type TypeName="diagram:SymbolSelectionMode"/> |
| 90 | + </ObjectDataProvider.MethodParameters> |
| 91 | + </ObjectDataProvider> |
| 92 | + </ResourceDictionary> |
| 93 | + </Window.Resources> |
| 94 | + |
| 95 | + <Grid> |
| 96 | + <Grid.ColumnDefinitions> |
| 97 | + <ColumnDefinition Width="Auto"/> |
| 98 | + <ColumnDefinition Width="3*"/> |
| 99 | + <ColumnDefinition Width="*"/> |
| 100 | + </Grid.ColumnDefinitions> |
| 101 | + |
| 102 | + |
| 103 | + <syncfusion:Stencil x:Name="stencil" Width="250" Title="Shapes" TitleTemplate="{StaticResource TitleTemplate}" |
| 104 | + SymbolGroupDisplayMode="{Binding SymbolGroupDisplayMode, Mode=TwoWay}" |
| 105 | + SymbolSelectionMode="{Binding SymbolSelectionMode, Mode=TwoWay}" |
| 106 | + DisplayMode="{Binding DisplayMode, Mode=TwoWay}" |
| 107 | + ShowSearchTextBox="{Binding ShowSearchTextBox}" |
| 108 | + ShowDisplayModeToggleButton="{Binding ShowDisplayModeToggleButton}" |
| 109 | + SymbolsDisplayMode="{Binding SymbolsDisplayMode,Mode=TwoWay}" |
| 110 | + Grid.Column="0" |
| 111 | + Grid.Row="1" |
| 112 | + Margin="5,5,0,5" |
| 113 | + Constraints="{Binding StencilConstraints}" |
| 114 | + ExpandMode="One" GroupMappingName="Key"> |
| 115 | + <!--Initialize the stencil categories--> |
| 116 | + <syncfusion:Stencil.SymbolGroups> |
| 117 | + <syncfusion:SymbolGroups> |
| 118 | + <!--Specify the basic shapes category with title and resource key--> |
| 119 | + <syncfusion:SymbolGroupViewModel Name="Basic Shapes" CategorySource="{StaticResource BasicShapes}"/> |
| 120 | + <syncfusion:SymbolGroupViewModel Name="Flow Shapes" CategorySource="{StaticResource FlowShapes}"/> |
| 121 | + <syncfusion:SymbolGroupViewModel Name="Arrow Shapes" CategorySource="{StaticResource ArrowShapes}"/> |
| 122 | + <syncfusion:SymbolGroupViewModel Name="DataFlow Shapes" CategorySource="{StaticResource DataFlowShapes}"/> |
| 123 | + </syncfusion:SymbolGroups> |
| 124 | + </syncfusion:Stencil.SymbolGroups> |
| 125 | + </syncfusion:Stencil> |
| 126 | + |
| 127 | + <!--Initializes Diagram--> |
| 128 | + <syncfusion:SfDiagram x:Name="diagram" |
| 129 | + Grid.Column="1" |
| 130 | + Margin="0,5,5,5" |
| 131 | + Nodes="{Binding Nodes}" |
| 132 | + Connectors="{Binding Connectors}" |
| 133 | + Swimlanes="{Binding Swimlanes}" |
| 134 | + Groups="{Binding Groups}" |
| 135 | + PageSettings="{Binding PageSettings}" |
| 136 | + HorizontalRuler="{Binding HorizontalRuler}" |
| 137 | + VerticalRuler="{Binding VerticalRuler}"> |
| 138 | + <!--SnapConstraints used to Control the Visibility of Gridlines and enable/disable Snapping.--> |
| 139 | + <syncfusion:SfDiagram.SnapSettings> |
| 140 | + <syncfusion:SnapSettings SnapConstraints="All" SnapToObject="All"/> |
| 141 | + </syncfusion:SfDiagram.SnapSettings> |
| 142 | + </syncfusion:SfDiagram> |
| 143 | + |
| 144 | + <StackPanel Grid.Column="2" Margin="0,20,0,0"> |
| 145 | + <Grid> |
| 146 | + <Grid.ColumnDefinitions> |
| 147 | + <ColumnDefinition Width="165"/> |
| 148 | + <ColumnDefinition Width="132"/> |
| 149 | + </Grid.ColumnDefinitions> |
| 150 | + |
| 151 | + <Grid.RowDefinitions> |
| 152 | + <RowDefinition Height="40"/> |
| 153 | + <RowDefinition Height="40"/> |
| 154 | + <RowDefinition Height="40"/> |
| 155 | + <RowDefinition Height="40"/> |
| 156 | + </Grid.RowDefinitions> |
| 157 | + <Label Grid.Row="0" Grid.Column="0" FontFamily="Segoe UI" FontWeight="Normal" FontSize="12px" Content="Display Mode"/> |
| 158 | + <Label Grid.Row="1" Grid.Column="0" FontFamily="Segoe UI" FontWeight="Normal" FontSize="12px" Content="Symbol Group Display Mode"/> |
| 159 | + <Label Grid.Row="2" Grid.Column="0" FontFamily="Segoe UI" FontWeight="Normal" FontSize="12px" Content="Symbol Display Mode"/> |
| 160 | + <Label Grid.Row="3" Grid.Column="0" FontFamily="Segeo UI" FontWeight="Normal" FontSize="12px" Content="Symbol Selection Mode"/> |
| 161 | + |
| 162 | + <ComboBox Height="22px" x:Name="DisplayMode" Margin="0,-15,0,0" Grid.Row="0" Grid.Column="1" |
| 163 | + ItemsSource="{Binding Source={StaticResource DisplayMode}}" SelectedItem="{Binding DisplayMode,Mode=TwoWay}" > |
| 164 | + </ComboBox> |
| 165 | + <ComboBox Height="22px" Margin="0,-15,0,0" Grid.Row="1" Grid.Column="1" |
| 166 | + ItemsSource="{Binding Source={StaticResource SymbolGroupDisplayMode}}" SelectedItem="{Binding SymbolGroupDisplayMode}"> |
| 167 | + </ComboBox> |
| 168 | + <ComboBox Height="22px" Margin="0,-15,0,0" Grid.Row="2" Grid.Column="1" |
| 169 | + SelectedItem="0" SelectionChanged="ComboBox_SelectionChanged" > |
| 170 | + <ComboBoxItem Content="Icons Only" IsSelected="True" /> |
| 171 | + <ComboBoxItem Content="Names Under Icons"/> |
| 172 | + </ComboBox> |
| 173 | + <ComboBox Height="22px" Margin="0,-15,0,0" Grid.Row="3" Grid.Column="1" |
| 174 | + ItemsSource="{Binding Source={StaticResource SymbolSelectionMode}}" SelectedItem="{Binding SymbolSelectionMode}"/> |
| 175 | + </Grid> |
| 176 | + <CheckBox Margin="0,10,0,10" IsChecked="{Binding ShowSearchTextBox, Mode=TwoWay}" Content="Show Search TextBox"></CheckBox> |
| 177 | + <CheckBox x:Name="showGridlines" Margin="0,10,0,10" |
| 178 | + IsChecked="{Binding ShowDisplayModeToggleButton, Mode=TwoWay}" |
| 179 | + Content="Show Display Mode Toggle Button" > |
| 180 | + </CheckBox> |
| 181 | + <CheckBox Margin="0,10,0,10" IsChecked="{Binding ShowPreview,Mode=TwoWay}" Content="Show Preview"> |
| 182 | + <CheckBox.ToolTip> |
| 183 | + <ToolTip Placement="Bottom" Content="While dragging symbol to the diagram preview of the dragged item will be shown instead of the original dragged item."/> |
| 184 | + </CheckBox.ToolTip> |
| 185 | + </CheckBox> |
| 186 | + <CheckBox Margin="0,10,0,0" IsChecked="{Binding EnableReorder,Mode=TwoWay}" Content="Enable Symbol Reorder"> |
| 187 | + <CheckBox.ToolTip> |
| 188 | + <ToolTip Placement="Bottom" Content="You can rearrange the symbols within it's symbol group."/> |
| 189 | + </CheckBox.ToolTip> |
| 190 | + </CheckBox> |
| 191 | + |
| 192 | + <Button x:Name="Save" Content="Save" HorizontalAlignment="Left" Height="40" Click="Save_Click" Width="120" Margin="0,20,0,0"/> |
| 193 | + |
| 194 | + <CheckBox x:Name="LoadSettings" Content="Load Settings" IsChecked="False" HorizontalAlignment="Left" Height="20" Width="120" Margin="0,20,0,0"/> |
| 195 | + |
| 196 | + <Button x:Name="Load" Content="Load" HorizontalAlignment="Left" Height="40" Click="Load_Click" Width="120" Margin="0,10,0,0"/> |
| 197 | + </StackPanel> |
| 198 | + </Grid> |
| 199 | +</Window> |
0 commit comments