Control / Container Node for WPF / Silverlight

Hi,

Is there the equivalent of the ControlNode class available for WPF / Silverlight. If not, is it being planned for a later release or should I start rolling my own version ?

Thanks
Andre

3 Replies

PM Pandi Murugan A Syncfusion Team August 21, 2010 06:37 AM UTC

Hi Andre,

Thank you for using Syncfusion Products.

In both WPF and Silverlight, we suggest you to use Syncfusion diagram Node’s Content property to host any control (UIElement) or any content inside a node in the diagram.

Please refer the following code snippet.



private void createNode()
{
Node n = new Node();
n.Shape = Shapes.Default;
Button b = new Button();
b.Content = "Click ME!";
n.Content = b;
(n.Content as Button).IsHitTestVisible = true;
dc.Model.Nodes.Add(n);
b.Click += new RoutedEventHandler(b_Click);
}

void b_Click(object sender, RoutedEventArgs e)
{
MessageBox.Show("i am fired"); // do something here;
}

Here, Button is a UIElement; similarly any UIElement can be hosted as a Node’s Content.



We have created a sample for your reference. Please refer the sample below.

Sample-806541268.zip

Please let me know if you have any concerns.

Regards,
Pandi Murugan A


AV Andre van Staden August 22, 2010 07:57 AM UTC

Thanks a lot,

I was trying this for days without any success. The answer is that I left out the creation of an instance of type Shape and the GUI elements was thus never visible and would never fire.

Thanks for the help - just goes to show that the simple solution (almost always) is the one that works.

Regards
Andre


PM Pandi Murugan A Syncfusion Team August 23, 2010 12:24 PM UTC

Hi Andre,

Thank you for your feedback.

Please get back us if you have any other concerns.

Regards,
Pandi Murugan A

Loader.
Up arrow icon