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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Textbox (UIElement) inside Node Content is not accessible. IsHitTestVisible="True" is not taking effect

Thread ID:

Created:

Updated:

Platform:

Replies:

128520 Jan 26,2017 02:09 PM UTC Jan 30,2017 09:39 AM UTC WPF 3
loading
Tags: Diagram
Srikanth
Asked On January 26, 2017 02:09 PM UTC

Hi,

I am trying to add textbox control into Node Content. 

It appears properly. However, I can't access the element. I have tried enabling 'IsHitTestVisible=True', but no luck.

I have attached my sample below. Can you please guide me with the solution to make UIElements (like textboxes, buttons) accessible from node content ?

Thanks,
Srikanth.

Attachment: DiagramTest_(3)_826b0c57.zip

Keerthivasan Ramamoorthy [Syncfusion]
Replied On January 27, 2017 11:53 AM UTC

Hi Srikanth, 
Requirement: “Need to Add UI Element (Textbox, Button,..etc) to Node Content”. 
We have a support to achieve your requirement. We have provided a code example to represent this. Please refer the code example as below. 
Code example: 
//AddNode method 
private Node addNode(double offsetx, double offsety, Shapes shape, String label, double width, double height) 
{ 
Node node = new Node(); 
node.OffsetX = offsetx; 
node.OffsetY = offsety; 
node.Shape = shape; 
TextBox b = new TextBox(); 
b.Text = label; 
node.Content = b; 
node.HorizontalContentAlignment = HorizontalAlignment.Center; 
node.VerticalContentAlignment = VerticalAlignment.Center; 
(node.Content as TextBox).IsHitTestVisible = true; 
node.Width = width; 
node.Height = height; 
model.Nodes.Add(node); 
return node; 
} 
 
Note: 
For more information about adding UI Element to Node content, please refer online documentation link as below. 
 
 
Regards, 
Keerthivasan R. 


Srikanth
Replied On January 27, 2017 03:26 PM UTC

Thanks Keerthi.

The example is working from from code behind. However, not working from XAML. Here is my code example.

Cam you please advise what is wrong with this code?  Thanks.

<syncfusion:DiagramControl Name="diagramControl" IsSymbolPaletteEnabled="False">
 
            <syncfusion:DiagramControl.Model>
 
                <syncfusion:DiagramModel   x:Name="diagramModel">
 
                    <syncfusion:DiagramModel.Nodes>
 
                        <syncfusion:Node Width="200" Height="70" Shape="FlowChart_Card">
                            <syncfusion:Node.Content>
                                <Button Content="Click Me!"></Button>
                            </syncfusion:Node.Content>
 
                        </syncfusion:Node>
 
                    </syncfusion:DiagramModel.Nodes>
 
                </syncfusion:DiagramModel>
 
            </syncfusion:DiagramControl.Model>
 
            <syncfusion:DiagramControl.View>
 
                <syncfusion:DiagramView IsZoomEnabled="True" Bounds="0,0,1200,1200" Name="diagramView">
 
                </syncfusion:DiagramView>
 
            </syncfusion:DiagramControl.View>
 
        </syncfusion:DiagramControl>


Suresh Shanmugam [Syncfusion]
Replied On January 30, 2017 09:39 AM UTC

Hi Srikanth, 
 
In order to the perform the operations on Node, we have internally set the IsHitTestVisible as false for the Content of the Node. So, Please set the IsHitTestVisible as true in DiagramLoaded event to make Content Editable at runtime. 
 
Please refer the code example for Diagram Loaded event as below. 

 
//Hook the loaded event 
diagramControl.Loaded += diagramControl_Loaded; 
 
private void diagramControl_Loaded(object sender, RoutedEventArgs e) 
{ 
       foreach (Node node in diagrammodel.Nodes) 
       { 
              (node.Content as TextBox).IsHitTestVisible = true;             
       }  
} 


Regards, 
Suresh Shanmugam 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;