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

  • SEARCH
  • Home
  • 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 4027556
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:06:40+00:00 2026-05-20T11:06:40+00:00

I need to enable editing properties of arbitrary objects (the type of object is

  • 0

I need to enable editing properties of arbitrary objects (the type of object is only known at run-time). I created the following class:

public class Camera
{
    [TypeConverter(typeof(ExpandableObjectConverter))]
    public object Configuration
    {
        get
        {
            return configuration; 
        }
        set 
        {
            configuration = value;
        }
    }

    public Class1 a;
    [TypeConverter(typeof(ExpandableObjectConverter))]
    public Class1 A
    {
        get
        {
            return a; 
        }
        set 
        {
            a = value;
        }
    }
}

After selecting object “Camera”, I can see the property of Class1 on PropertyGrid, but I can’t see the property of object “Configuration”. How can I fix this problem?

  • 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-20T11:06:41+00:00Added an answer on May 20, 2026 at 11:06 am

    My assumption was that your form becomes visible before the Configuration property was assigned. You didn’t supply enough code to see if that was the case. In order to test out my concern, I created two configuration objects:

    public class Configuration1
    {
        public string Test { get; set; }
        public byte Test1 { get; set; }
        public int Test2 { get; set; }
    }
    

    and

    public class Configuration2
    {
        public char Test3 { get; set; }
        public List<string> Test4 { get; set; }
    }
    

    I modified your camera class to look like this:

    public class Camera
    {
        public Camera()
        {
            Configuration1 = new Configuration1();
            Configuration2 = new Configuration2();
        }
        private object configuration;
    
        [TypeConverter(typeof(ExpandableObjectConverter))]
        public object Configuration { get; set; }
    
        [TypeConverter(typeof(ExpandableObjectConverter))]
        public Configuration1 Configuration1 { get; set; }
    
        [TypeConverter(typeof(ExpandableObjectConverter))]
        public Configuration2 Configuration2 { get; set; }
    }
    

    I then created a form with a PropertyGrid and two Button instances. I configured the form interactions like this:

    public partial class Form1 : Form
    {
        private readonly Camera camera = new Camera();
        public Form1()
        {
            InitializeComponent();
    
            propertyGrid1.SelectedObject = camera;
        }
    
        private void Button1Click(object sender, System.EventArgs e)
        {
            camera.Configuration = new Configuration2();
            UpdatePropertyGrid();
        }
    
        private void Button2Click(object sender, System.EventArgs e)
        {
            camera.Configuration = new Configuration1();
            UpdatePropertyGrid();
        }
    
        private void UpdatePropertyGrid()
        {
            propertyGrid1.Refresh();
            propertyGrid1.ExpandAllGridItems();
        }
    }
    

    The startup view looks like this:

    enter image description here

    After clicking the first button:

    enter image description here

    After clicking the second button:

    enter image description here

    If you remove the refresh, the property grid does not work correctly. The alternative is to supply an interface with INotifyPropertyChanged on your classes and properties.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a GUI application where I need to enable editing properties of arbitrary
I have the following jQuery script to show a model dialog to enable editing
I am using date picker of extjs 4. I need to enable only three
I need to enable word wrapping and tail truncation, at the same time, on
I need to Enable/Disable my SAVE button in real time based on data in
I need a JComponent thad enables editing xml documents so I can embed it
I need to enable/disable completely network interfaces from a script in Windows XP. I'm
I need to enable the mcrypt functions on my website, except I'm on a
I need to enable/disable post comments regarding the value of a new field in
Here: http://freshmeat.net/projects/myperl/ I need to enable PHP in MySQL

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.