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.

Custom Property Editor. Show only name of node

Thread ID:

Created:

Updated:

Platform:

Replies:

121923 Feb 9,2016 06:43 AM Feb 11,2016 01:16 AM Windows Forms 3
loading
Tags: Diagram
Blanca Calderon
Asked On February 9, 2016 06:43 AM

Hi,

I would like to have my own property editor with only one property, the name of the node. What is the property who show me this?

I've tried this but it doesn't work.

 /// Customer class to be displayed in the property grid
    /// </summary>
    /// 
    [DefaultPropertyAttribute("Name")]
    class PropertyPV
    {
        private string _name;      
        
        [CategoryAttribute("General"), DescriptionAttribute("Name")]
        public string Name
        {
            get
            {
                return _name;
            }

            set
            {
                _name = value;
            }
        }      

        public PropertyPV()
{
//
// TODO: Add constructor logic here
//
}

Naganathan Ganesh Babu [Syncfusion]
Replied On February 10, 2016 07:30 AM

Hi Blanca,
Thanks for contacting Syncfusion support.     

By default, diagram’s property container which displays all properties of the diagram’s nodes while assigning the diagram into the PropertyEditor’s “Diagram”. If you want to display custom property of the node, please create the PropertyGrid instead of PropertyEditor and use the PropertyGrid’s “Selectedobject” property to display the custom property of the node.


Please refer to the attached code example and sample.


Code example:


[C#]


Node node = evtArgs.Element as Node;

if (node.PropertyBag.Keys.Count == 0)

{

node.PropertyBag.Add("Name", node.Name);

}

if (node.PropertyBag.Keys.Count > 0)

{

CommonProperties properties = new CommonProperties();

properties.Name = node.PropertyBag["Name"].ToString();

propertyGrid1.SelectedObject = properties;

}


Sample:


Sample



However we have created another sample for displaying only the custom properties (which is defined in customized class) in PropertyEditor. Please create the custom class inherited from TypeConvertor class and use TypeDescriptor.CreateProperty() method to add custom property name to display properties you want.



Sample:


Sample



 
Regards,
 
Naganathan K G


Blanca Calderon
Replied On February 10, 2016 07:38 AM

Could you send me the samples in framework 3.5 (syncfusion version 13.1350.0.21)?

Thank you.

Naganathan Ganesh Babu [Syncfusion]
Replied On February 11, 2016 01:16 AM

Hi Blanca,
In previous update, we have provided the sample with 3.5 framework and 13.1350.0.21 version. Please ensure whether all the DLL's are referred properly in the provided project and also ensure that the DLLs are installed in your system’s GAC location. By default, the project’s DLLs are referred from GAC location. If DLLs are not installed in GAC location, then please refer to the DLLs manually in the sample. 
However, we have attached sample with bin folder. Please refer to the below samples for your references.  
Custom property with customized class sample:
Sample 
Custom property with display property using PropertyGrid sample:
Sample
Regards,
Naganathan K G



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.

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.

;