You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A set of stencil symbols can be combined together to create a group and many numbers of group can be created. This helps you to look overall stencil symbols into split view and it is easy to find specific or particular shape category into stencil.
13
13
14
-
## Group symbols into a category
14
+
## SymbolCollection With GroupMappingName in Stencil
15
15
16
16
The symbols of the same category can be grouped using the [GroupMappingName](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Diagram.Stencil.Stencil.html#Syncfusion_UI_Xaml_Diagram_Stencil_Stencil_GroupMappingName) property of the [Stencil](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Diagram.Stencil.html) class. The `Stencil` groups the symbols based on the `GroupMappingName` property, which specifies the name of the property whose value will determine the group category. In the following code example, the `GroupMappingName` is set to "Key", so the `Stencil` will create the SymbolGroups based on the value of the Key property.
17
17
@@ -229,18 +229,70 @@ When there is more number of symbol groups in the stencil, then you can expand a
229
229
|ZeroOrMore| Enables none or more symbol group that can be expanded ||
230
230
|ZeroOrOne | Enables none or one symbol group that can be expanded ||
231
231
232
-
## Symbol categories
232
+
## SymbolGroupViewModel in Stencil
233
233
234
-
There are plenty of shapes available in the diagram resource dictionary. It takes more time and allows repeated code samples to add all symbols to the stencil. To avoid this, the shapes are split and categorized as a list of symbols in the [StencilCategory](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Diagram.Stencil.StencilCategory.html) class. You can add more than one category using the [`Categories`](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Diagram.Stencil.Stencil.html#Syncfusion_UI_Xaml_Diagram_Stencil_Stencil_Categories) property of the stencil class.
234
+
The [SymbolGroupViewModel](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Diagram.Stencil.SymbolGroupViewModel.html) class provides the support to create the view models to the symbol group and provides supports to add symbols to it as Node, Connectors, groups and list of predefined symbols. It includes the following properties:
235
235
236
-
The `Categories` can be mentioned by using the following properties of the `StencilCategory` class:
236
+
* [Name](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Diagram.Stencil.SymbolGroupViewModel.html#Syncfusion_UI_Xaml_Diagram_Stencil_SymbolGroupViewModel_Name): Specifies the display name of the symbol group. It also adds the symbols to the symbol groups defined through the `SymbolSource` property which symbol has same `Key` value as this `Name` property.
237
+
* [Symbols](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Diagram.Stencil.SymbolGroupViewModel.html#Syncfusion_UI_Xaml_Diagram_Stencil_SymbolGroupViewModel_Symbols): Specifies the list of symbols need to be added to the symbol group. It can be any diagram elements such as Nodes, Connectors, Groups, Containers, BPMN elements.
238
+
* [CategorySource](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Diagram.Stencil.SymbolGroupViewModel.html#Syncfusion_UI_Xaml_Diagram_Stencil_SymbolGroupViewModel_CategorySource): Specifies the list of symbols need to be added to the `SymbolGroupViewModel` using the static resource key value from the predefined category collections.
237
239
238
-
* Keys: Specifies the static resource key name value of the category collection.
239
-
*Title: Specifies the title that should be displayed as aheader of the category collection.
240
+
Additionally, You can dynamically add new symbols to symbol groups or remove existing ones at runtime. Similarly, you can also add or remove entire symbol groups within the stencil as needed.
240
241
241
-
## Built-in symbol categories
242
+
### Adding Symbols via Symbols Property in SymbolGroupViewModel
242
243
243
-
The built-in shape paths available in the diagram resource dictionary are grouped by categories. The following are the built-in categories being available in the diagram resource dictionary:
244
+
To add symbols through the `Symbols` property, you can define a collection of symbols directly within the `SymbolGroupViewModel`, allowing for more customized symbol definitions.
[View Sample in GitHub](https://github.com/SyncfusionExamples/WPF-Diagram-Examples/tree/master/Samples/Stencil/SymbolGroupViewModel/BasicSymbolGroupViewModel)
292
+
293
+
### Adding Symbols via CategorySource Property in SymbolGroupViewModel
294
+
295
+
The `sfDiagram` resource dictionary includes a wide array of shapes organized into categorized lists. These shape paths are grouped into specific categories to simplify the process of adding them to the stencil, avoiding repetitive additions. Below are the built-in categories available in the diagram resource dictionary:
244
296
245
297
* BasicShapes
246
298
* FlowShapes
@@ -253,73 +305,52 @@ The built-in shape paths available in the diagram resource dictionary are groupe
253
305
* SwimlaneShapes
254
306
* BPMNEditorShapes
255
307
256
-
{% tabs %}
257
-
{% highlightxaml %}
258
-
<!--Initialize the stencil-->
259
-
<stencil:Stencil x:Name="stencil"
260
-
Title="Shapes"
261
-
TitleTemplate="{StaticResourceTitleTemplate}"
262
-
ExpandMode="ZeroOrMore"
263
-
BorderBrush="#dfdfdf"
264
-
BorderThickness="1"
265
-
GroupMappingKey="Key">
266
-
<!--Initialize the stencil categories-->
267
-
<stencil:Stencil.Categories>
268
-
<stencil:StencilCategoryCollection>
269
-
<!--Specify the basic shapes category with title and resource key-->
You can also create custom symbol collections. This additional flexibility allows you to tailor the stencil to your specific needs beyond the built-in options.
278
309
279
-
## Add the custom shapes categories
310
+
To add symbols to a Stencil through `SymbolGroupViewModel`, you can utilize the `CategorySource` property, which allows you to bind a predefined collection of symbols based on a static resource key. This enables dynamic loading of symbols into the group, ensuring that any updates to the category collection are reflected in the symbol group automatically.
280
311
281
-
The custom symbol collections can be added to the stencil by defining the custom symbol's resource collection.
N> The custom symbol collections should be added in the App.xaml file.
353
+
{% endhighlight %}
323
354
324
355
## Customize the appearance of the symbols in the built-in categories
325
356
@@ -381,51 +412,6 @@ public class StencilViewModel : Stencil
381
412
382
413
[View Sample in GitHub](https://github.com/SyncfusionExamples/WPF-Diagram-Examples/tree/master/Samples/Stencil/StencilCategory)
383
414
384
-
## View Models for the SymbolGroups
385
-
386
-
The `SfDiagram` provides supports to populate view models for each SymbolGroup created for the symbols added through the `SymbolSource` property.
387
-
388
-
The [SymbolGroupViewModel](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Diagram.Stencil.SymbolGroupViewModel.html) class provides the support to create the view models to the symbol group and provides supports to add symbols to it as Node, Connectors, groups and list of predefined symbols.
389
-
390
-
* [Name](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Diagram.Stencil.SymbolGroupViewModel.html#Syncfusion_UI_Xaml_Diagram_Stencil_SymbolGroupViewModel_Name): Specifies the display name of the symbol group. It also adds the symbols to the symbol groups defined through the `SymbolSource` property which symbol has same `Key` value as this `Name` property.
391
-
* [Symbols](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Diagram.Stencil.SymbolGroupViewModel.html#Syncfusion_UI_Xaml_Diagram_Stencil_SymbolGroupViewModel_Symbols): Specifies the list of symbols need to be added to the symbol group. It can be any diagram elements of Nodes, Connectors, Groups, Containers, BPMN elements.
392
-
* [CategorySource](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Diagram.Stencil.SymbolGroupViewModel.html#Syncfusion_UI_Xaml_Diagram_Stencil_SymbolGroupViewModel_CategorySource): Specifies the list of symbols need to be added to the `SymbolGroupViewModel` using the static resource key value from the predefined category collections.
393
-
394
-
In addition to that, new symbols can be added into the symbol groups or you can remove the existing symbols from any symbol group at run time. As same as symbols, new symbol group can be added into the stencil and remove the existing symbol group from the stencil.
[View Sample in GitHub](https://github.com/SyncfusionExamples/WPF-Diagram-Examples/tree/master/Samples/Stencil/SymbolGroupViewModel/BasicSymbolGroupViewModel)
0 commit comments