We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Button inside a node and context menu

Hi everyone,

I have two questions. I have an app where every Node contains two buttons(add new child, delete itself) if I press one of these buttons the Node gets automaticaly selected by default. Is there a way to prevent the auto selection if I press the button inside the node?

the second question is: how I can override the default context menu which shows up if I select a node? for instance, I want that, if I select a node only the border of a selected node changes his color and no context menu shows up

thanks in advance,
Vladimir.

4 Replies

VL Vladimir November 7, 2014 08:43 AM UTC

The first issue with the buttons is resolved now.
 public class NoBubleButton : Button
    {
        protected override void OnTapped(TappedRoutedEventArgs e)
        {
            base.OnTapped(e);
            e.Handled = true;            
        }
    }

But I am still looking forward for your piece of advice for the second problem I have.


SC Saranya Chandrasekaran Syncfusion Team November 7, 2014 09:10 AM UTC

Hi Vladimir,

Please find the response of your queries as below.

S.No

Query

Response

1.

Is there a way to prevent the auto selection if I press the button inside the node?

 

We have support to enable/ disable the Node Selection behavior. Your requirement can be achieved by using NodeConstraints. Please refer to the following code snippet to disable Node selection.

 

Code Snippet:

 

node.Constraints=node1.Constraints &~ NodeConstraints.Selectable;

//Here, node is the instance of the node

 

For more details about Node constraints, please refer to the following online help documentation link.

Link:

http://help.syncfusion.com/UG/winrt/documents/nodes.htm :  Node Constraints

2.

how I can override the default context menu which shows up if I select a node? for instance, I want that, if I select a node only the border of a selected node changes his color and no context menu shows up

 

We don’t have any default context menu for Node.

Your requirement “to change the border of the selected Node” can be achieved by using ShapeStyle property of the Node.

 

 

For more details about Node shape and shape style, please refer to the following online help documentation link.

 

Link:

http://help.syncfusion.com/UG/winrt/documents/nodes.htm :

Setting the Node Shape and Shape Style

 

This would be better for us if you provide more information about your context menu  requirement. So that we will investigate further on this and update you with the proper solution.

 

 

Please let us know if you have any concerns

Regards,

Saranya C

 



VL Vladimir November 7, 2014 09:27 AM UTC

Thanks for the response. The solution you provided is not suitable in my case. I still want to keep nodes selectable the only thing I wanted to override is a selection if I press on a button inside a node. Nevermind, I already found a solution...
about the context menu. If I select a node a "toolbox" shows up... The question was, How I can prevent it from showing ?



thanks!


SC Saranya Chandrasekaran Syncfusion Team November 10, 2014 07:09 AM UTC

Hi Vladimir,

Please find the response of your query as below.

S.No

Query

Response

1.

If I select a node a "toolbox" shows up... The question was, How I can prevent it from showing ?

 

 

We have analyzed your requirement from your query. Your requirement is disable the Quick Commands (Delete, Duplicate and Connection) in the Node. We have provided code snippet to achieve your requirement. Please refer to the code snippet as below.

Code Snippet:

//Disable Quick Commands

(diagram.SelectedItems as SelectorViewModel).QuickCommands = Visibility.Collapsed;

//Here, diagram is the name of the SfDiagram.

 

Please let us know if you have any concerns

Regards,
Saranya C


Loader.
Up arrow icon