Articles in this section
Category / Section

How to enable or disable context menu in Xamarin Diagram?

1 min read

This article explains how to enable or disable the context menu in Xamarin Diagram.

 

Step 1:

Create a SfDiagram sample with all the necessary assemblies. Refer to this Getting started documentation to create and configure a simple SfDiagram sample.

 

Step 2:

You can customize the visibility of the context menu when you do a long press on a node or connector in SfDiagram which includes cut, copy, delete and paste options. The default value is ‘True’

 

XAML

<Grid>
<syncfusion:SfDiagram  VerticalOptions="FillAndExpand" x:Name="diagram" >
    <syncfusion:SfDiagram.Nodes>
        <syncfusion:NodeCollection>
              <!--Initialize Node-->
              <syncfusion:Node Width="200" Height="200" OffsetX="100" OffsetY="100"/>      
        </syncfusion:NodeCollection>
    </syncfusion:SfDiagram.Nodes>
    <syncfusion:SfDiagram.ContextMenuSettings>
              <syncfusion:ContextMenuSettings Visibility="False"/>
    </syncfusion:SfDiagram.ContextMenuSettings>
</syncfusion:SfDiagram>
</Grid>

 

 

CS

SfDiagram diagram = new SfDiagram();
Node node = new Node { Width = 200, Height = 200, OffsetX = 100, OffsetY = 100 };
diagram.AddNode(node);
diagram.ContextMenuSettings.Visibility = false;
this.Content = diagram;

 

 

The sample that explains how to enable or disable the context menu in SfDiagram can be downloaded here.

 

Conclusion

I hope you enjoyed learning about how to enable or disable context menu in Xamarin Diagram.

You can refer to our Xamarin.Forms Diagram feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied