Class Stencil
Represents the library of shapes.
Inheritance
Namespace: Syncfusion.UI.Xaml.Diagram.Stencil
Assembly: Syncfusion.SfDiagram.WPF.dll
Syntax
public class Stencil : Control
Constructors
Stencil()
Initializes a new instance of the Stencil class.
Declaration
public Stencil()
Fields
CategoriesProperty
Using a DependencyProperty as the backing store for Categories property. This enables animation, styling, binding, etc...
Declaration
public static DependencyProperty CategoriesProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
ConstraintsProperty
Using a DependencyProperty as the backing store for Constraints property. This enables animation, styling, binding, etc...
Declaration
public static DependencyProperty ConstraintsProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
DiagramThemeProperty
Identifies the DiagramTheme dependency property.
Declaration
public static DependencyProperty DiagramThemeProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
DisplayModeProperty
Using a DependencyProperty as the backing store for DisplayMode property. This enables animation, styling, binding, etc...
Declaration
public static readonly DependencyProperty DisplayModeProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
ExpandModeProperty
Using a DependencyProperty as the backing store for ExpandMode property. This enables animation, styling, binding, etc...
Declaration
public static DependencyProperty ExpandModeProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
GroupMappingNameProperty
Using a DependencyProperty as the backing store for SymbolGroup property. This enables animation, styling, binding, etc...
Declaration
public static DependencyProperty GroupMappingNameProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
HeaderVisibilityProperty
Using a DependencyProperty as the backing store for HeaderVisibility property. This enables animation, styling, binding, etc...
Declaration
public static DependencyProperty HeaderVisibilityProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
ItemAddingCommandProperty
Identifies the ItemAddingCommand dependency property.
Declaration
public static DependencyProperty ItemAddingCommandProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
ItemDeletingCommandProperty
Identifies the ItemDeletingCommand dependency property.
Declaration
public static DependencyProperty ItemDeletingCommandProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
MenuItemClickedCommandProperty
Identifies the MenuItemClickedCommand dependency property.
Declaration
public static DependencyProperty MenuItemClickedCommandProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
MenuOpeningCommandProperty
Identifies the MenuOpeningCommand dependency property.
Declaration
public static DependencyProperty MenuOpeningCommandProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
MenuProperty
Identifies the Menu dependency property.
Declaration
public static DependencyProperty MenuProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
SelectedFilterProperty
Using a DependencyProperty as the backing store for SelectedFilter property. This enables animation, styling, binding, etc...
Declaration
public static DependencyProperty SelectedFilterProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
SelectedItemsProperty
Identifies the SelectedItems dependency property.
Declaration
public static DependencyProperty SelectedItemsProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
SelectedSymbolProperty
Using a DependencyProperty as the backing store for SelectedSymbol. This enables animation, styling, binding, etc...
Declaration
public static DependencyProperty SelectedSymbolProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
SelectionChangedCommandProperty
Identifies the SelectionChangedCommand dependency property.
Declaration
public static DependencyProperty SelectionChangedCommandProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
ShowDisplayModeToggleButtonProperty
Using a DependencyProperty as the backing store for ShowDisplayModeToggleButton property. This enables animation, styling, binding, etc...
Declaration
public static readonly DependencyProperty ShowDisplayModeToggleButtonProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
ShowSearchTextBoxProperty
Using a DependencyProperty as the backing store for ShowSearchTextBox property. This enables animation, styling, binding, etc...
Declaration
public static readonly DependencyProperty ShowSearchTextBoxProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
SymbolFilterDisplayModeProperty
Using a DependencyProperty as the backing store for SymbolFilterDisplayMode property. This enables animation, styling, binding, etc...
Declaration
public static readonly DependencyProperty SymbolFilterDisplayModeProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
SymbolFiltersProperty
Using a DependencyProperty as the backing store for SymbolFilters property. This enables animation, styling, binding, etc...
Declaration
public static DependencyProperty SymbolFiltersProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
SymbolGroupDisplayModeProperty
Identifies the SymbolGroupDisplayMode dependency property.
Declaration
public static readonly DependencyProperty SymbolGroupDisplayModeProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
SymbolGroupProperty
Using a DependencyProperty as the backing store for SymbolGroup property. This enables animation, styling, binding, etc...
Declaration
public static DependencyProperty SymbolGroupProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
SymbolGroupsProperty
Using a DependencyProperty as the backing store for SymbolGroup property. This enables animation, styling, binding, etc...
Declaration
public static DependencyProperty SymbolGroupsProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
SymbolPreviewProperty
Using a DependencyProperty as the backing store for SymbolPreview. This enables animation, styling, binding, etc...
Declaration
public static DependencyProperty SymbolPreviewProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
SymbolsDisplayModeProperty
Identifies the SymbolsDisplayMode dependency property.
Declaration
public static DependencyProperty SymbolsDisplayModeProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
SymbolSelectionModeProperty
Using a DependencyProperty as the backing store for SymbolSelectionMode property. This enables selection mode for stencil elements.
Declaration
public static DependencyProperty SymbolSelectionModeProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
SymbolSourceProperty
Identifies the Syncfusion.UI.Xaml.Diagram.Stencil.SymbolSource dependency property.
Declaration
public static DependencyProperty SymbolSourceProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
TitleProperty
Using a DependencyProperty as the backing store for Title property. This enables animation, styling, binding, etc...
Declaration
public static readonly DependencyProperty TitleProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
TitleTemplateProperty
Using a DependencyProperty as the backing store for TitleTemplate property. This enables animation, styling, binding, etc...
Declaration
public static readonly DependencyProperty TitleTemplateProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
Properties
Categories
Gets or sets the stencil groups collection.
Declaration
public StencilCategoryCollection Categories { get; set; }
Property Value
Type |
---|
StencilCategoryCollection |
Examples
Below example shows how to group the symbols in the stencil. #MainWindow.xaml
<!--Initialize the stencil-->
<Stencil:Stencil x:Name="stencil">
<!--Initialize the stencil categories-->
<Stencil:Stencil.Categories>
<Stencil:StencilCategoryCollection>
<!--Specify the basic shapes category with title and resource key-->
<Stencil:StencilCategory Title = "Basic Shapes" Keys="{StaticResource BasicShapes}"/>
<Stencil:StencilCategory Title = "Flow Shapes" Keys="{StaticResource FlowShapes}"/>
<Stencil:StencilCategory Title = "Arrow Shapes" Keys="{StaticResource ArrowShapes}"/>
</Stencil:StencilCategoryCollection>
</Stencil:Stencil.Categories>
<!--Initialize the SymbolGroup-->
<stencil:Stencil.SymbolGroups>
<stencil:SymbolGroups>
<!--Map Symbols Using MappingName-->
<stencil:SymbolGroupProvider MappingName = "Key" >
</ stencil:SymbolGroupProvider>
</stencil:SymbolGroups>
</stencil:Stencil.SymbolGroups>
</stencil:Stencil>
//Collection of Symbols
public class SymbolCollection : ObservableCollection<object>
{
}
CommandManager
Gets or sets the CommandManager of the Stencil to customize the keyboard commands.
Declaration
public StencilCommandManager CommandManager { get; set; }
Property Value
Type |
---|
StencilCommandManager |
Commands
Gets the commands associated with the stencil.
Declaration
public IStencilCommand Commands { get; }
Property Value
Type |
---|
IStencilCommand |
Constraints
Gets or sets the default behaviours of stencil.
Declaration
public StencilConstraints Constraints { get; set; }
Property Value
Type |
---|
StencilConstraints |
DiagramTheme
Gets or sets the theme to a collection of property settings that allow you to define the look of stencil elements.
Declaration
public DiagramTheme DiagramTheme { get; set; }
Property Value
Type |
---|
DiagramTheme |
DisplayMode
Gets or sets a value that specifies how the stencil and content areas of a stencil are being shown.
Declaration
public DisplayMode DisplayMode { get; set; }
Property Value
Type |
---|
DisplayMode |
Examples
<syncfusion:Stencil x:Name="stencil" Width="250" DisplayMode="Compact">
<!--Initialize the SymbolSource-->
<syncfusion:Stencil.SymbolSource>
<!--Define the SymbolCollection-->
<syncfusion:SymbolCollection>
<syncfusion:NodeViewModel Key = "Basic Shapes" Name="Triangle" OffsetX="100" OffsetY="100" UnitHeight="100" UnitWidth="100" Shape="{StaticResource Triangle}" ShapeStyle="{StaticResource nodestyle}" >
</syncfusion:NodeViewModel>
</syncfusion:SymbolCollection>
</syncfusion:Stencil.SymbolSource>
<syncfusion:Stencil.SymbolGroups>
<syncfusion:SymbolGroups>
<!--Separate groups based on the key-->
<syncfusion:SymbolGroupProvider MappingName = "Key" />
</ syncfusion:SymbolGroups>
</syncfusion:Stencil.SymbolGroups>
</syncfusion:Stencil>
ExpandMode
Gets or sets a value that indicates the number of symbol group expanded in stencil.
Declaration
public ExpandMode ExpandMode { get; set; }
Property Value
Type |
---|
ExpandMode |
Remarks
This is applicable only for the DisplayMode as ComboBox
GroupMappingName
Declaration
public string GroupMappingName { get; set; }
Property Value
Type |
---|
System.String |
HeaderVisibility
Gets or sets the header visibility of the symbol groups in stencil.
Declaration
public Visibility HeaderVisibility { get; set; }
Property Value
Type |
---|
System.Windows.Visibility |
ItemAddingCommand
Occurs before an item is added to the Stencil.
Declaration
public ICommand ItemAddingCommand { get; set; }
Property Value
Type |
---|
System.Windows.Input.ICommand |
ItemDeletingCommand
Occurs before an item is deleted from the Stencil.
Declaration
public ICommand ItemDeletingCommand { get; set; }
Property Value
Type |
---|
System.Windows.Input.ICommand |
KnownTypes
Gets or sets a collection of known types that may be present in the stencil for serialization.
Declaration
public GetTypes KnownTypes { get; set; }
Property Value
Type |
---|
GetTypes |
Menu
Gets or sets the additional menu items for context menu.
Declaration
public DiagramMenu Menu { get; set; }
Property Value
Type |
---|
DiagramMenu |
MenuItemClickedCommand
Occurs when a menu item is clicked.
Declaration
public ICommand MenuItemClickedCommand { get; set; }
Property Value
Type |
---|
System.Windows.Input.ICommand |
MenuOpeningCommand
Occurs when any context menu on the element is opened.
Declaration
public ICommand MenuOpeningCommand { get; set; }
Property Value
Type |
---|
System.Windows.Input.ICommand |
SelectedFilter
Gets or sets a filter from the colloection the SymbolFilters in stencil.
Declaration
public SymbolFilterProvider SelectedFilter { get; set; }
Property Value
Type |
---|
SymbolFilterProvider |
SelectedItems
Gets or sets the selected items of the Syncfusion.UI.Xaml.Diagram.Stencil.
Declaration
public SymbolCollection SelectedItems { get; set; }
Property Value
Type |
---|
SymbolCollection |
SelectedSymbol
Gets or sets a selected symbol in stencil.
Declaration
public Symbol SelectedSymbol { get; set; }
Property Value
Type |
---|
Symbol |
SelectionChangedCommand
Occurs when the selection changes (new items are selected, or currently selected items are unselected).
Declaration
public ICommand SelectionChangedCommand { get; set; }
Property Value
Type |
---|
System.Windows.Input.ICommand |
ShowDisplayModeToggleButton
Gets or sets the value indicates whether to show/hide the display mode toggle button. The default value is true.
Declaration
public bool ShowDisplayModeToggleButton { get; set; }
Property Value
Type |
---|
System.Boolean |
Examples
<syncfusion:Stencil x:Name="stencil" Width="250" Title="Stencil Shapes" ShowDisplayModeToggleButton="false" >
<!--Initialize the SymbolSource-->
<syncfusion:Stencil.SymbolSource>
<!--Define the SymbolCollection-->
<syncfusion:SymbolCollection>
<syncfusion:NodeViewModel Key = "Basic Shapes" Name="Triangle" OffsetX="100" OffsetY="100" UnitHeight="100" UnitWidth="100" Shape="{StaticResource Triangle}" ShapeStyle="{StaticResource nodestyle}" >
</syncfusion:NodeViewModel>
</syncfusion:SymbolCollection>
</syncfusion:Stencil.SymbolSource>
<syncfusion:Stencil.SymbolGroups>
<syncfusion:SymbolGroups>
<!--Separate groups based on the key-->
<syncfusion:SymbolGroupProvider MappingName = "Key" />
</ syncfusion:SymbolGroups>
</syncfusion:Stencil.SymbolGroups>
</syncfusion:Stencil>
ShowSearchTextBox
Gets or sets value indicates whether to display the symbol search textbox in the Stencil.
Declaration
public bool ShowSearchTextBox { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Examples
Below example shows how to enable the search textbox in stencil.
<syncfusion:Stencil x:Name="stencil" Width="250" ExpandMode="All" ShowSearchTextBox="True">
<!--Initialize the SymbolSource-->
<syncfusion:Stencil.SymbolSource>
<!--Define the SymbolCollection-->
<syncfusion:SymbolCollection>
<syncfusion:NodeViewModel Key = "Basic Shapes" Name="Triangle" OffsetX="100" OffsetY="100" UnitHeight="100" UnitWidth="100" Shape="{StaticResource Triangle}" ShapeStyle="{StaticResource nodestyle}" >
</syncfusion:NodeViewModel>
</syncfusion:SymbolCollection>
</syncfusion:Stencil.SymbolSource>
<syncfusion:Stencil.SymbolGroups>
<syncfusion:SymbolGroups>
<!--Separate groups based on the key-->
<syncfusion:SymbolGroupProvider MappingName = "Key" />
</ syncfusion:SymbolGroups>
</syncfusion:Stencil.SymbolGroups>
</syncfusion:Stencil>
SymbolFilterDisplayMode
Gets or sets value indicates how the SymbolGroupHeader should be displayed. The default value is set to ComboBox.
Declaration
public SymbolFilterDisplayMode SymbolFilterDisplayMode { get; set; }
Property Value
Type |
---|
SymbolFilterDisplayMode |
Remarks
The display mode can be either ComboBox or List
Examples
Below example shows how to enable the SymbolFilterDisplayMode as List. #MainWindow.xaml
<Window.DataContext>
<local:StencilVM></local:StencilVM>
</Window.DataContext>
<syncfusion:Stencil x:Name="stencil" Width="250" Title="Stencil Shapes" SymbolFilterDisplayMode="List" SymbolFilters="{Binding Symbolfilters}" SelectedFilter="{Binding Selectedfilter}">
<!--Initialize the SymbolSource-->
<syncfusion:Stencil.SymbolSource>
<!--Define the SymbolCollection-->
<syncfusion:SymbolCollection>
<syncfusion:NodeViewModel Key = "Basic Shapes" Name="Triangle" OffsetX="100" OffsetY="100" UnitHeight="100" UnitWidth="100" Shape="{StaticResource Triangle}" ShapeStyle="{StaticResource nodestyle}" >
</syncfusion:NodeViewModel>
</syncfusion:SymbolCollection>
</syncfusion:Stencil.SymbolSource>
<syncfusion:Stencil.SymbolGroups>
<syncfusion:SymbolGroups>
<!--Separate groups based on the key-->
<syncfusion:SymbolGroupProvider MappingName = "Key" />
</ syncfusion:SymbolGroups>
</syncfusion:Stencil.SymbolGroups>
</syncfusion:Stencil>
public class StencilVM : INotifyPropertyChanged
{
public StencilVM()
{
Symbolfilters = new SymbolFilters();
SymbolFilterProvider node1 = new SymbolFilterProvider { Content = "Basic Shapes",IsChecked=true, SymbolFilter = Filter };
this.Symbolfilters.Add(node1);
this.Selectedfilter = Symbolfilters[0];
}
//Define filtering of Symbols
private bool Filter(SymbolFilterProvider sender, object symbol)
{
if (symbol is NodeViewModel)
{
if (sender.Content.ToString() == (symbol as NodeViewModel).Key.ToString())
return true;
}
return false;
}
public ObservableCollection<SymbolFilterProvider> Symbolfilters { get; set; }
public SymbolFilterProvider Selectedfilter { get; set; }
public event PropertyChangedEventHandler PropertyChanged;
}
SymbolFilters
Gets or sets a collection used to generate the SymbolFilters in stencil.
Declaration
public SymbolFilters SymbolFilters { get; set; }
Property Value
Type |
---|
SymbolFilters |
Examples
Below code example shows how to define the symbol filter in the stencil
public class StencilVM : INotifyPropertyChanged
{
public StencilVM()
{
Symbolfilters = new SymbolFilters();
SymbolFilterProvider all = new SymbolFilterProvider { Content = "All", SymbolFilter = Filter };
SymbolFilterProvider Node = new SymbolFilterProvider { Content = "Nodes", SymbolFilter = Filter };
SymbolFilterProvider Con = new SymbolFilterProvider { Content = "Connector", SymbolFilter = Filter };
this.Symbolfilters.Add(all);
this.Symbolfilters.Add(Node);
this.Symbolfilters.Add(Con);
this.Selectedfilter = Symbolfilters[0];
}
// Define filtering of Symbols
private bool Filter(SymbolFilterProvider sender, object symbol)
{
if (symbol is NodeViewModel)
{
if (sender.Content.ToString() == (symbol as NodeViewModel).Key.ToString())
return true;
}
if (symbol is ConnectorViewModel)
{
if (sender.Content.ToString() == (symbol as ConnectorViewModel).Key.ToString())
return true;
}
if (sender.Content.ToString() == "All")
{
return true;
}
return false;
}
public ObservableCollection<SymbolFilterProvider> Symbolfilters { get; set; }
public SymbolFilterProvider Selectedfilter { get; set; }
public event PropertyChangedEventHandler PropertyChanged;
}
}
SymbolGroupDisplayMode
Gets or sets value indicates how the SymbolGroup should be displayed.
Declaration
public SymbolGroupDisplayMode SymbolGroupDisplayMode { get; set; }
Property Value
Type | Description |
---|---|
SymbolGroupDisplayMode | The display mode for the SymbolGroup. Default is Accordion. |
Remarks
This property determines how the SymbolGroup is visually presented within the Stencil. The available display modes are: Accordion, List, and Tab.
Examples
Below example shows how to enable the SymbolGroupDisplayMode as Tab.
<syncfusion:Stencil x:Name="stencil" Width="250" Title="Stencil Shapes" SymbolGroupDisplayMode="Tab">
<!--Initialize the SymbolSource-->
<syncfusion:Stencil.SymbolSource>
<!--Define the SymbolCollection-->
<syncfusion:SymbolCollection>
<syncfusion:NodeViewModel Key = "Basic Shapes" Name="Triangle" OffsetX="100" OffsetY="100" UnitHeight="100" UnitWidth="100" Shape="{StaticResource Triangle}" ShapeStyle="{StaticResource nodestyle}" />
<syncfusion:NodeViewModel Key = "Flow Shapes" Name="Decision" OffsetX="100" OffsetY="100" UnitHeight="100" UnitWidth="100" Shape="{StaticResource Decision}" ShapeStyle="{StaticResource nodestyle}" />
</syncfusion:SymbolCollection>
</syncfusion:Stencil.SymbolSource>
<syncfusion:Stencil.SymbolGroups>
<syncfusion:SymbolGroups>
<!--Separate groups based on the key-->
<syncfusion:SymbolGroupProvider MappingName = "Key" />
</ syncfusion:SymbolGroups>
</syncfusion:Stencil.SymbolGroups>
</syncfusion:Stencil>
SymbolGroupMenu
Gets or sets the additional menu items for context menu.
Declaration
public DiagramMenu SymbolGroupMenu { get; set; }
Property Value
Type |
---|
DiagramMenu |
SymbolGroups
Gets or sets a collection used to generate the SymbolGroupProvider in stencil.
Declaration
public SymbolGroups SymbolGroups { get; set; }
Property Value
Type |
---|
SymbolGroups |
Examples
Below example shows how to group the symbols in the stencil. #MainWindow.xaml
<stencil:Stencil Grid.Column="0" BorderThickness="1" BorderBrush="#dfdfdf" x:Name="stencil">
<!--Initialize the SymbolSource-->
<stencil:Stencil.SymbolSource>
<!--Define the SymbolCollection-->
<local:SymbolCollection>
<syncfusion:NodeViewModel x:Name="node" UnitHeight="70" UnitWidth="100" OffsetX="100" OffsetY="100" Shape="{StaticResource Rectangle}" Key="Node">
</syncfusion:NodeViewModel>
<syncfusion:ConnectorViewModel SourcePoint = "100,100" TargetPoint="200,200" Key="Connector"/>
<!--Define the DiagramElement- Group-->
<syncfusion:GroupViewModel Key = "Group" >
< !--Creates the Groupable Nodes-->
<syncfusion:GroupViewModel.Nodes>
<syncfusion:NodeCollection>
<syncfusion:NodeViewModel UnitHeight = "70" ID="srcnode" OffsetX="0" OffsetY="300" UnitWidth="100" Shape="{StaticResource Rectangle}"></syncfusion:NodeViewModel>
<syncfusion:NodeViewModel UnitHeight = "70" ID="tarnode" OffsetX="100" OffsetY="500" UnitWidth="100" Shape="{StaticResource Rectangle}"></syncfusion:NodeViewModel>
</syncfusion:NodeCollection>
</syncfusion:GroupViewModel.Nodes>
<!--Creates the Groupable Connectors-->
<syncfusion:GroupViewModel.Connectors>
<syncfusion:ConnectorCollection>
<syncfusion:ConnectorViewModel SourceNodeID = "srcnode" TargetNodeID="tarnode"/>
</syncfusion:ConnectorCollection>
</syncfusion:GroupViewModel.Connectors>
</syncfusion:GroupViewModel>
</local:SymbolCollection>
</stencil:Stencil.SymbolSource>
<!--Initialize the SymbolGroup-->
<stencil:Stencil.SymbolGroups>
<stencil:SymbolGroups>
<!--Map Symbols Using MappingName-->
<stencil:SymbolGroupProvider MappingName = "Key" >
</ stencil:SymbolGroupProvider>
</stencil:SymbolGroups>
</stencil:Stencil.SymbolGroups>
</stencil:Stencil>
//Collection of Symbols
public class SymbolCollection : ObservableCollection<object>
{
}
SymbolPreview
Gets or sets the preview of symbol when drag from stencil.
Declaration
public ContentPresenter SymbolPreview { get; set; }
Property Value
Type |
---|
System.Windows.Controls.ContentPresenter |
SymbolsDisplayMode
Gets or sets a value indicates how the symbols should be displayed in the Syncfusion.UI.Xaml.Diagram.Stencil. The default is IconsOnly.
Declaration
public SymbolsDisplayMode SymbolsDisplayMode { get; set; }
Property Value
Type |
---|
SymbolsDisplayMode |
See Also
SymbolSelectionMode
Gets or sets a value that indicates the selection mode of the symbols in stencil is single or multiple.
Declaration
public SymbolSelectionMode SymbolSelectionMode { get; set; }
Property Value
Type |
---|
SymbolSelectionMode |
SymbolSource
Gets or sets a collection used to generate the symbol in stencil.
Declaration
public object SymbolSource { get; set; }
Property Value
Type |
---|
System.Object |
Examples
<!--Initialize the SymbolSource-->
<stencil:Stencil.SymbolSource>
<!--Define the SymbolCollection-->
<local:SymbolCollection>
<Syncfusion:SymbolViewModel Symbol = "User" SymbolTemplate="{StaticResource symboltemplate}"/>
<syncfusion:NodeViewModel x:Name="node" UnitHeight="70" UnitWidth="100" OffsetX="100" OffsetY="100" Shape="{StaticResource Rectangle}">
</syncfusion:NodeViewModel>
<syncfusion:ConnectorViewModel SourcePoint = "100,100" TargetPoint="200,200"/>
<!--Define the DiagramElement- Group-->
<syncfusion:GroupViewModel>
<!--Creates the Groupable Nodes-->
<syncfusion:GroupViewModel.Nodes>
<syncfusion:NodeCollection>
<syncfusion:NodeViewModel UnitHeight = "70" ID="srcnode" OffsetX="0" OffsetY="300" UnitWidth="100" Shape="{StaticResource Rectangle}"> </syncfusion:NodeViewModel>
<syncfusion:NodeViewModel UnitHeight = "70" ID="tarnode" OffsetX="100" OffsetY="500" UnitWidth="100" Shape="{StaticResource Rectangle}"> </syncfusion:NodeViewModel>
</syncfusion:NodeCollection>
</syncfusion:GroupViewModel.Nodes>
<!--Creates the Groupable Connectors-->
<syncfusion:GroupViewModel.Connectors>
<syncfusion:ConnectorCollection>
<syncfusion:ConnectorViewModel SourceNodeID = "srcnode" TargetNodeID="tarnode"/>
</syncfusion:ConnectorCollection>
</syncfusion:GroupViewModel.Connectors>
</syncfusion:GroupViewModel>
</local:SymbolCollection>
</stencil:Stencil.SymbolSource>
//Collection of Symbols
public class SymbolCollection : ObservableCollection<object>
{
}
Title
Gets or sets the title of the Stencil. The default title is null.
Declaration
public object Title { get; set; }
Property Value
Type |
---|
System.Object |
Examples
<syncfusion:Stencil x:Name="stencil" Width="250" ExpandMode="All" Title="Stencil Shapes">
<!--Initialize the SymbolSource-->
<syncfusion:Stencil.SymbolSource>
<!--Define the SymbolCollection-->
<syncfusion:SymbolCollection>
<syncfusion:NodeViewModel Key = "Basic Shapes" Name="Triangle" OffsetX="100" OffsetY="100" UnitHeight="100" UnitWidth="100" Shape="{StaticResource Triangle}" ShapeStyle="{StaticResource nodestyle}" >
</syncfusion:NodeViewModel>
</syncfusion:SymbolCollection>
</syncfusion:Stencil.SymbolSource>
<syncfusion:Stencil.SymbolGroups>
<syncfusion:SymbolGroups>
<!--Separate groups based on the key-->
<syncfusion:SymbolGroupProvider MappingName = "Key" />
</ syncfusion:SymbolGroups>
</syncfusion:Stencil.SymbolGroups>
</syncfusion:Stencil>
TitleTemplate
Gets or sets the title template used to display the title of the Stencil.
Declaration
public DataTemplate TitleTemplate { get; set; }
Property Value
Type |
---|
System.Windows.DataTemplate |
Examples
<DataTemplate x:Key="TitleTemplate">
<TextBlock Text="{Binding}" Foreground="Black" FontSize="14" ></TextBlock>
</DataTemplate>
<syncfusion:Stencil x:Name="stencil" Width="250" ExpandMode="All" Title="Stencil Shapes" TitleTemplate="{StaticResource TitleTemplate}" >
<!--Initialize the SymbolSource-->
<syncfusion:Stencil.SymbolSource>
<!--Define the SymbolCollection-->
<syncfusion:SymbolCollection>
<syncfusion:NodeViewModel Key = "Basic Shapes" Name="Triangle" OffsetX="100" OffsetY="100" UnitHeight="100" UnitWidth="100" Shape="{StaticResource Triangle}" ShapeStyle="{StaticResource nodestyle}" >
</syncfusion:NodeViewModel>
</syncfusion:SymbolCollection>
</syncfusion:Stencil.SymbolSource>
<syncfusion:Stencil.SymbolGroups>
<syncfusion:SymbolGroups>
<!--Separate groups based on the key-->
<syncfusion:SymbolGroupProvider MappingName = "Key" />
</ syncfusion:SymbolGroups>
</syncfusion:Stencil.SymbolGroups>
</syncfusion:Stencil>
Methods
add_Collapsed(SymbolGroupCollapseEventHandler)
Declaration
public void add_Collapsed(SymbolGroupCollapseEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
SymbolGroupCollapseEventHandler | value |
add_Expanded(SymbolGroupExpandEventHandler)
Declaration
public void add_Expanded(SymbolGroupExpandEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
SymbolGroupExpandEventHandler | value |
add_ItemAdding(ItemAddingEventHandler)
Declaration
public void add_ItemAdding(ItemAddingEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
ItemAddingEventHandler | value |
add_ItemDeleting(ItemDeletingEventHandler)
Declaration
public void add_ItemDeleting(ItemDeletingEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
ItemDeletingEventHandler | value |
add_MenuItemClicked(MenuItemClickedEventHander)
Declaration
public void add_MenuItemClicked(MenuItemClickedEventHander value)
Parameters
Type | Name | Description |
---|---|---|
MenuItemClickedEventHander | value |
add_MenuOpening(MenuOpeningEventHandler)
Declaration
public void add_MenuOpening(MenuOpeningEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
MenuOpeningEventHandler | value |
add_SelectionChanged(SelectionChangedEventHandler)
Declaration
public void add_SelectionChanged(SelectionChangedEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
SelectionChangedEventHandler | value |
add_SymbolsLoaded(SymbolsLoadedEventHandler)
Declaration
public void add_SymbolsLoaded(SymbolsLoadedEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
SymbolsLoadedEventHandler | value |
ArrangeOverride(Size)
Declaration
protected override Size ArrangeOverride(Size finalSize)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Size | finalSize |
Returns
Type |
---|
System.Windows.Size |
CacheContextMenuforItemOverride(ContextMenu)
Store the System.Windows.Controls.ContextMenu element to stack for recycling.
Declaration
protected virtual void CacheContextMenuforItemOverride(ContextMenu view)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Controls.ContextMenu | view | Store the view instance to stack for recycling. |
CacheMenuItemforItemsOverride(MenuItem)
Store the System.Windows.Controls.MenuItem element to stack for recycling.
Declaration
protected virtual void CacheMenuItemforItemsOverride(MenuItem view)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Controls.MenuItem | view | Parameter to store the menuitem instance to stack for recycling. |
CanAddSymbol(String, String)
Virtual method to decide whether the symbol can be added into collection or not.
Declaration
protected virtual bool CanAddSymbol(string SymbolName, string CategoryName)
Parameters
Type | Name | Description |
---|---|---|
System.String | SymbolName | Name of the symbol. |
System.String | CategoryName | Name of the symbol category. |
Returns
Type | Description |
---|---|
System.Boolean | Returns the bool. |
Remarks
This virtual method is applicable only when category collection is provided.
GetContextMenuForItemOverride()
Creates or identifies the view that is used to display the ContextMenu.
Declaration
protected virtual ContextMenu GetContextMenuForItemOverride()
Returns
Type | Description |
---|---|
System.Windows.Controls.ContextMenu | Returns a instance of ContextMenu. |
GetMenuItemForItemsOverride()
Creates or identifies the view that is used to display the ContextMenu Item.
Declaration
protected virtual MenuItem GetMenuItemForItemsOverride()
Returns
Type | Description |
---|---|
System.Windows.Controls.MenuItem | Returns a instance of MenuItem. |
GetSymbolForItemOverride(Object)
Creates the view that is used to represent the given symbol.
Declaration
public virtual Symbol GetSymbolForItemOverride(object item)
Parameters
Type | Name | Description |
---|---|---|
System.Object | item |
Returns
Type |
---|
Symbol |
GetSymbolGroupForItemOverride(Object)
Creates the view that is used to represent the given symbol group.
Declaration
public virtual SymbolGroup GetSymbolGroupForItemOverride(object item)
Parameters
Type | Name | Description |
---|---|---|
System.Object | item |
Returns
Type |
---|
SymbolGroup |
Load(Stream)
Loading the existing saved stencil from the data stream.
Declaration
public void Load(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | A System.IO.Stream that contains the data for this Stencil. |
OnApplyTemplate()
When overridden in a derived class, is invoked whenever application code or internal processes call System.Windows.FrameworkElement.ApplyTemplate.
Declaration
public override void OnApplyTemplate()
OnCreateAutomationPeer()
Declaration
protected override AutomationPeer OnCreateAutomationPeer()
Returns
Type |
---|
System.Windows.Automation.Peers.AutomationPeer |
OnSymbolsLoaded(SymbolsLoadedEventArgs)
Invokd when symbols are loaded into stencil.
Declaration
public void OnSymbolsLoaded(SymbolsLoadedEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
SymbolsLoadedEventArgs | args | Data for loaded symbols. |
PrepareDragDropPreview()
Method to customize the preview of symbol while dropping.
Declaration
protected virtual void PrepareDragDropPreview()
PrepareSymbolViewModel(Object, String, String)
Virtual method to override the default category collection, customize the symbol and its values.
Declaration
protected virtual object PrepareSymbolViewModel(object Item, string SymbolName, string CategoryName)
Parameters
Type | Name | Description |
---|---|---|
System.Object | Item | Symbol of the collection |
System.String | SymbolName | Name of the symbol |
System.String | CategoryName | name of the symnol category |
Returns
Type | Description |
---|---|
System.Object | Returns the symbol of the collection |
Remarks
This virtual method is applicable only when category collection is provided.
remove_Collapsed(SymbolGroupCollapseEventHandler)
Declaration
public void remove_Collapsed(SymbolGroupCollapseEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
SymbolGroupCollapseEventHandler | value |
remove_Expanded(SymbolGroupExpandEventHandler)
Declaration
public void remove_Expanded(SymbolGroupExpandEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
SymbolGroupExpandEventHandler | value |
remove_ItemAdding(ItemAddingEventHandler)
Declaration
public void remove_ItemAdding(ItemAddingEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
ItemAddingEventHandler | value |
remove_ItemDeleting(ItemDeletingEventHandler)
Declaration
public void remove_ItemDeleting(ItemDeletingEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
ItemDeletingEventHandler | value |
remove_MenuItemClicked(MenuItemClickedEventHander)
Declaration
public void remove_MenuItemClicked(MenuItemClickedEventHander value)
Parameters
Type | Name | Description |
---|---|---|
MenuItemClickedEventHander | value |
remove_MenuOpening(MenuOpeningEventHandler)
Declaration
public void remove_MenuOpening(MenuOpeningEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
MenuOpeningEventHandler | value |
remove_SelectionChanged(SelectionChangedEventHandler)
Declaration
public void remove_SelectionChanged(SelectionChangedEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
SelectionChangedEventHandler | value |
remove_SymbolsLoaded(SymbolsLoadedEventHandler)
Declaration
public void remove_SymbolsLoaded(SymbolsLoadedEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
SymbolsLoadedEventHandler | value |
Save(Stream)
Saves this Stencil to the specified stream.
Declaration
public void Save(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | The Stream where the stencil will be saved.. |
SearchSymbol(String)
Search a specific symbol in stencil.
Declaration
public void SearchSymbol(string str)
Parameters
Type | Name | Description |
---|---|---|
System.String | str | Symbol key. |
Events
Collapsed
Occurs when collapse the symbol group.
Declaration
public event SymbolGroupCollapseEventHandler Collapsed
Event Type
Type |
---|
SymbolGroupCollapseEventHandler |
Expanded
Occurs when expand the symbol group.
Declaration
public event SymbolGroupExpandEventHandler Expanded
Event Type
Type |
---|
SymbolGroupExpandEventHandler |
ItemAdding
Occurs before an item is added to the Stencil.
Declaration
public event ItemAddingEventHandler ItemAdding
Event Type
Type |
---|
ItemAddingEventHandler |
ItemDeleting
Occurs before an item is deleted from the Stencil.
Declaration
public event ItemDeletingEventHandler ItemDeleting
Event Type
Type |
---|
ItemDeletingEventHandler |
MenuItemClicked
Occurs when a menu item is clicked.
Declaration
public event MenuItemClickedEventHander MenuItemClicked
Event Type
Type |
---|
MenuItemClickedEventHander |
MenuOpening
Occurs when any context menu on the element is opened.
Declaration
public event MenuOpeningEventHandler MenuOpening
Event Type
Type |
---|
MenuOpeningEventHandler |
SelectionChanged
Occurs when the selection changes (new items are selected, or currently selected items are unselected).
Declaration
public event SelectionChangedEventHandler SelectionChanged
Event Type
Type |
---|
SelectionChangedEventHandler |
SymbolsLoaded
Occurs when the symbol is laid out, rendered, and ready for interaction
Declaration
public event SymbolsLoadedEventHandler SymbolsLoaded
Event Type
Type |
---|
SymbolsLoadedEventHandler |