Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Viewing properties of custom nodes in the property grid (Read 3802 times)
newbieDraw
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 24
Joined: Dec 22nd, 2011
Viewing properties of custom nodes in the property grid
Apr 2nd, 2012 at 2:43pm
Print Post  
Hi Stoyo,

Is it possible to view and set properties for custom node types (some string and numeric values) in the property grid, during runtime. I am trying to set the selected node as the object for property grid but it doesn't work.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Viewing properties of custom nodes in the property grid
Reply #1 - Apr 2nd, 2012 at 4:40pm
Print Post  
Hi,

Are your custom properties public? I think the property grid displays only public properties.

Stoyan
  
Back to top
 
IP Logged
 
newbieDraw
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 24
Joined: Dec 22nd, 2011
Re: Viewing properties of custom nodes in the property grid
Reply #2 - Apr 2nd, 2012 at 4:49pm
Print Post  
Hi Stoyo,

Find the code snippets attached. The properties are public.
Code
Select All
public class cNode : ShapeNode
    {
        public string label;

        public string Label
        {
            get { return label; }
            set { label = value;}
        }
    }
 


Code
Select All
private void diagram1_NodeSelected(object sender, NodeEventArgs e)
        {
            DiagramNode node = e.Node;
            cNode cnode = node as cNode;
            propertyGrid1.SelectedObject = cnode;
        }
 

  
Back to top
 
IP Logged
 
newbieDraw
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 24
Joined: Dec 22nd, 2011
Re: Viewing properties of custom nodes in the property grid
Reply #3 - Apr 2nd, 2012 at 5:32pm
Print Post  
Also, when I create a new cNode object in my form constructor, the property grid shows the custom properties. However, it doesn't show for the specific nodes that are created within diagramView.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Viewing properties of custom nodes in the property grid
Reply #4 - Apr 2nd, 2012 at 6:06pm
Print Post  
Do you mean nodes drawn with the mouse don't have these properties? That probably happens because the nodes are ShapeNode instances. You will have to set Behavior = Custom and CustomNodeType = typeof(cNode) to enable drawing custom nodes.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
newbieDraw
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 24
Joined: Dec 22nd, 2011
Re: Viewing properties of custom nodes in the property grid
Reply #5 - Apr 2nd, 2012 at 6:44pm
Print Post  
I had set Behavior = Custom and CustomNodeType = typeof(cNode) to enable drawing custom nodes. It didn't work. Let me know if you have any other ideas. I will try to troubleshoot.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Viewing properties of custom nodes in the property grid
Reply #6 - Apr 3rd, 2012 at 6:24am
Print Post  
The IconNodes sample project sets Behavior and CustomNodeType the same way. Adding a property grid to it shows the new properties of IconNode objects - Label and Icon. Check if your Behavior value doesn't change to DrawShapes or LinkShapes later, e.g. it might reset to LinkShapes if you load a file using DiagramView.Load methods.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint