Category / Section
How to restrict the symbol dropping from the SymbolPalette in the WPF Diagram (SfDiagram)?
3 mins read
The symbols can be restricted from the symbol palate before dropping on the diagram page by using the Cancel argument of the ItemDropEventArgs class and ItemDropEvent of WPF Diagram (SfDiagram) class.
C#
public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); SfDiagram diagram = new SfDiagram(); (diagram.Info as IGraphInfo).ItemDropEvent += MainWindow_ItemDropEvent; } private void MainWindow_ItemDropEvent(object sender, ItemDropEventArgs args) { if (args.ItemSource == Cause.Stencil && (args.Source as INode).Key.ToString() == "Basic Shapes") { args.Cancel = true; } } }