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

Custom Property Editor. Show only name of node

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
//
}

3 Replies

NG Naganathan Ganesh Babu Syncfusion Team February 10, 2016 12:30 PM UTC

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



BC Blanca Calderon February 10, 2016 12:38 PM UTC

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

Thank you.


NG Naganathan Ganesh Babu Syncfusion Team February 11, 2016 06:16 AM UTC

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



Loader.
Up arrow icon