Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3346222
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T01:16:41+00:00 2026-05-18T01:16:41+00:00

I am trying to create a WPF based PropertyGrid. Recently i tried wpg.codeplex.com project,

  • 0

I am trying to create a WPF based PropertyGrid.

Recently i tried wpg.codeplex.com project, but i had some problems with this control.
Now, i am trying to develop http://blog.joachim.at/?p=36 this project.

I successfully added Enum Values, support but i have got problems with collections.

For example my custom object has a property that name is City and type is Guid.
I want, users can select City from combobox.

I was fighting with TypeConverts, IValueConverts, and etc..

How can i solve this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T01:16:41+00:00Added an answer on May 18, 2026 at 1:16 am

    After hours of work i solved my problem.
    I had need only TypeConverter to solve this, so i created a class that derives from TypeConverter.

        class PierListConverter : TypeConverter
            {
                ArrayList piers = new ArrayList();
                public PierListConverter()
                {
    
                }
                public override bool
                GetStandardValuesSupported(ITypeDescriptorContext context)
                {
                    return true;
                }
                public override StandardValuesCollection
                GetStandardValues(ITypeDescriptorContext context)
                {
                    // This method returns me the list that will use to fill combo at property grid.
                    piers.Clear();
                    foreach (var item in GullsEyeModel.GetInstance().GetPiers())
                    {
                        piers.Add(item.Id);
                    }
                    StandardValuesCollection cols = new  StandardValuesCollection(piers);
                    return cols;
                }
                public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
                {
                   // If this method returns true, ConvertFrom method will invoke
                    if (sourceType == typeof(string))
                    {
                        return true;
                    }
                    else
                    return base.CanConvertFrom(context, sourceType);
                }
                public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
                {
                    // In this method i am getting selected text and querying; after that i retrieve proparete Guid value and then returning back to my object that binded property grid.
                    if (value != null)
                    {
                        if (value.ToString() == "Seçiniz")
                        {
                            return Guid.Empty;
                        }
                        else if (!string.IsNullOrEmpty(value.ToString()))
                        {
                            GuidConverter g = new GuidConverter();
                            PierItem[] pierArray = GullsEyeModel.GetInstance().GetPiers();
                            PierItem selectedPier = pierArray.Where(item => item.Info.Name == value.ToString()).FirstOrDefault();
                            if (selectedPier != null)
                            {
                                return selectedPier.Id;
                            }
                            else
                                return base.ConvertFrom(context, culture, value);
                        }
                        else
                            return base.ConvertFrom(context, culture, value);
                    }
                    else
                    return base.ConvertFrom(context, culture, value);
                }
                public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
                {
    // In this method i am converting ID to string (Name) to display in Property Grid
                    if (value != null)
                    {
                        GuidConverter g = new GuidConverter();
                        PierItem[] piers = GullsEyeModel.GetInstance().GetPiers();
                        PierItem selectedPier = piers.Where(item => item.Id== (Guid)g.ConvertFromString(value.ToString())).FirstOrDefault();
                        if (selectedPier != null)
                        {
                            return selectedPier.Info.Name;
                        }
                        else
                            return "Seçiniz";
                    }
                    else
                    return base.ConvertTo(context, culture, value, destinationType);
                }
            }
    

    Using custom TypeConverter

    class MyClass
    {
    
    // my some props..
    
    // my some props..
    
    [TypeConverter(typeof(PierListConverter))]      
    public Guid PierId {get; set;}
    
    // my some methods..
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a WPF Shape (PolyLine) editor, which is a control that
I am trying to create a WPF application that takes command line arguments. If
I'm trying to create a WPF application where I can drag an image around.
I am trying to create a databound WPF GridView whose rows can either be
I am trying create a WCF service that leverages the WPF MediaPlayer on the
I have a problem with my WPF program. I'm trying to create an object
Trying to create a user account in a test. But getting a Object reference
I'm trying to create my own Media Player application using a WPF MediaElement. I
I am trying to create Below parent child structur using WPF tree. Tree ->Parent
Using Silverlight 4 & WPF 4, I'm trying to create a button style that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.