How can I have PropertyGrid in Sukram WPF Diagram Designer Sample?

I'm trying to have propertyGrid in Sukram WPF Diagram Designer Sample(WPF Diagram Designer - Part 4) and I'm Novice in wpf. How can I add Proper PropertyGrid in this project which I can show all properties of each Item in designer Canvas and also I can multi select the Items from designer canvas to show there common properties, and also I have custom property for each Item in designer. If every one has experience or has similar sample, please share with me. thank you

Answers


You can use windows PropertyGrid in you WPF application. you can create a class contain all properties you wanna show in propertygrid for example:

[TypeConverter(typeof(AllItemsTypeConverter))]   
public class AllItems
{

    public string Name
    {
        get { // }
        set { // }
    }

    public String description
    {
        get { // }
        set { // }
    }

}

there is a type convertor for AllItems Class you can filters your Items for each object you want like this:

  class AllItemsTypeConverter: ExpandableObjectConverter
    {

        public override PropertyDescriptorCollection GetProperties(
            ITypeDescriptorContext context, object value, Attribute[] attributes)
        {

            var originalProperties = base.GetProperties(context, value, attributes);
            var propertyDescriptorList = new List<PropertyDescriptor>(originalProperties.Count);

            foreach (PropertyDescriptor propertyDescriptor in originalProperties)
            {
                bool showPropertyDescriptor = true;
                switch (propertyDescriptor.Name)
                {
                    // this properties belong to Input
                    case "InputPlayInstance": showPropertyDescriptor = designerNode.ShowInput; break;
                    case "InputNodeInputSetup": showPropertyDescriptor = designerNode.ShowInput; break;
                    case "InputGrammerList": showPropertyDescriptor = designerNode.ShowInput; break;


.
.
.
.
                }

                if (showPropertyDescriptor) propertyDescriptorList.Add(propertyDescriptor);
            }


            return new PropertyDescriptorCollection(propertyDescriptorList.ToArray());
        }
    }

that class override the "GetProperties" method of "ExpandableObjectConverter" class you can specify that property to belong specific object or no.


Need Your Help

Postgresql JPA Hibernate create Database

java spring hibernate postgresql jpa

I'm having trouble with Postgresql with JPA Hibernate.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.