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 7758967
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T13:30:22+00:00 2026-06-01T13:30:22+00:00

I’m trying to make an editor for a game which has an event system,

  • 0

I’m trying to make an editor for a game which has an event system, with a base class for the events and then another class for each kind which actually do all the stuff.

So, I have a list of BaseEvent which shows in a PropertyGrid, and as a list, the collection editor opens. I prepared a TypeConverter so I have a dropdown with all derived classes which shows in the “Value” property.

Everything is OK, properties from derived classes show as children of “Value”, but as soon as I want to show a property from BaseEvent, the “Value” property disappears, and children appear at the root, so I’m unable to change the type of the event.

Is there a way to make the “Value” property appear at the same time as the BaseEvent properties?

//This allows to get a dropdown for the derived classes
public class EventTypeConverter : ExpandableObjectConverter
{
    public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
    {
        return new StandardValuesCollection(GetAvailableTypes());
    }

    /*
    ...
    */
}

[TypeConverter(typeof(EventTypeConverter))]
public abstract class BaseEvent
{
    public bool BaseProperty; //{ get; set; } If I set this as a property, "Value" disappears
}

public class SomeEvent : BaseEvent
{
    public bool SomeOtherProperty { get; set; }
}

//The object selected in the PropertyGrid is of this type
public class EventManager
{
    public List<BaseEvent> Events { get; set; } //The list that opens the collection editor
}
  • 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-06-01T13:30:24+00:00Added an answer on June 1, 2026 at 1:30 pm

    Finally I found a way to solve this: through the GetProperties method, and a custom PropertyDescriptor:

    public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
    {
        //Get the base collection of properties
        PropertyDescriptorCollection basePdc = base.GetProperties(context, value, attributes);
    
        //Create a modifiable copy
        PropertyDescriptorCollection pdc = new PropertyDesctiptorCollection(null);
        foreach (PropertyDescriptor descriptor in basePdc)
            pdc.Add(descriptor);
    
        //Probably redundant check to see if the value is of a correct type
        if (value is BaseEvent)
            pdc.Add(new FieldDescriptor(typeof(BaseEvent), "BaseProperty"));
        return pdc;
    }
    
    public class FieldDescriptor : SimplePropertyDescriptor
    {
        //Saves the information of the field we add
        FieldInfo field;
    
        public FieldDescriptor(Type componentType, string propertyName)
            : base(componentType, propertyName, componentType.GetField(propertyName, BindingFlags.Instance | BindingFlags.NonPublic).FieldType)
        {
            field = componentType.GetField(propertyName, BindingFlags.Instance | BindingFlags.NonPublic);
        }
    
        public override object GetValue(object component)
        {
            return field.GetValue(component);
        }
    
        public override void SetValue(object component, object value)
        {
            field.SetValue(component, value);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I am trying to understand how to use SyndicationItem to display feed which is
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I am trying to render a haml file in a javascript response like so:

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.