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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T23:19:58+00:00 2026-06-12T23:19:58+00:00

I created a custom control with several properties. I add some expandable property to

  • 0

I created a custom control with several properties. I add some expandable property to my custom control. Now, I want that user can edit expandable property field in the property grid and new entered values set for their related properties. My expandable property in the property grid is “Required Sign” and has two sub properties as follows:

  1. ForeColor

  2. Visible

I set two sub properties’ values of the “Required Sign” expandable property to the field of the “Required Sign” property as you can see in the following figure:

"Required Sign" expandable property

  1. Green Box: “Required Sign” Expandable Property

  2. Blue Box: Two sub properties of the “Required Sign” Expandable Property

  3. Red Box: Field of the “Required Sign” Expandable Property

However, I can’t change or edit field values of the “Required Sign” expandable property directly. How can I change or edit field values of expandable property (Red Box in the figure)?

My codes as follows:

[DisplayName("Label Information")]
[Description("Label Informationnnnnnnnnnnnnnnn")]
[DefaultProperty("Text")]
[DesignerCategory("Component")]
[TypeConverter(typeof(AllFloorsContentsLabelInformationTypeConverter))]
public class AllFloorsContentsLabelInformation : LabelX
{
    private AllFloorsContentsLabelRequiredSignInformation allFloorsContentsLabelRequiredSignInformation = new AllFloorsContentsLabelRequiredSignInformation();

    public AllFloorsContentsLabelInformation()
    {

    }

    [Category("Data")]
    [DisplayName("Required Sign")]
    [Description("Required Signnnnnnnnnnnnnnn")]
    [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
    public AllFloorsContentsLabelRequiredSignInformation AllFloorsContentsLabelRequiredSignInfo
    {
        get
        {
            return allFloorsContentsLabelRequiredSignInformation;
        }
    }
}

[DisplayName("Required Sign Information")]
[Description("Required Sign Informationnnnnnnnnnnnnnnn")]
[DefaultProperty("Text")]
[DesignerCategory("Component")]
[TypeConverter(typeof(AllFloorsContentsLabelRequiredSignInformationTypeConverter))]
public class AllFloorsContentsLabelRequiredSignInformation
{
    private Color foreColor = Color.Red;
    private ConfirmationAnswers visible = ConfirmationAnswers.Yes;

    public AllFloorsContentsLabelRequiredSignInformation()
    {

    }

    [Category("Appearance")]
    [DisplayName("ForeColor")]
    [Description("ForeColor")]
    [DefaultValue(typeof(Color), "Red")]
    [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
    public new Color ForeColor
    {
        get
        {
            return foreColor;
        }
        set
        {
            foreColor = value;
        }
    }

    [Category("Behavior")]
    [DisplayName("Visible")]
    [Description("Visibleeeeeeeeeeeeeeeeee")]
    [DefaultValue(ConfirmationAnswers.Yes)]
    [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
    public ConfirmationAnswers Visible
    {
        get
        {
            return visible;
        }
        set
        {
            visible = value;
        }
    }
}

public class AllFloorsContentsLabelRequiredSignInformationTypeConverter : ExpandableObjectConverter//TypeConverter
{
    public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
    {
        if (destinationType == typeof(AllFloorsContentsLabelRequiredSignInformation))
        {
            return true;
        }
        return base.CanConvertTo(context, destinationType);
    }

    public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
    {
        if (destinationType == typeof(String) && value is AllFloorsContentsLabelRequiredSignInformation)
        {
            AllFloorsContentsLabelRequiredSignInformation allFloorsContentsLabelRequiredSignInformation = (AllFloorsContentsLabelRequiredSignInformation)value;
            return allFloorsContentsLabelRequiredSignInformation.ForeColor.ToString() + "; " + allFloorsContentsLabelRequiredSignInformation.Visible.ToString();
        }
        return base.ConvertTo(context, culture, value, destinationType);
    }

    public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
    {
        if (sourceType == typeof(string))
        {
            return true;
        }
        return base.CanConvertFrom(context, sourceType);
    }

    public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
    {
        if (value is string)
        {
            AllFloorsContentsLabelRequiredSignInformation allFloorsContentsLabelRequiredSignInformation = new AllFloorsContentsLabelRequiredSignInformation();
            string strExtractData = (string)value;
            Color clrForeColor = Color.FromName(strExtractData.Substring(0, strExtractData.IndexOf(";") - 1).Trim());
            string strVisible = strExtractData.Substring(strExtractData.IndexOf(";") + 1, strExtractData.Length).Trim();

            allFloorsContentsLabelRequiredSignInformation.ForeColor = clrForeColor;
            if (strVisible == "Yes")
            {
                allFloorsContentsLabelRequiredSignInformation.Visible = ConfirmationAnswers.Yes;
            }
            else
            {
                allFloorsContentsLabelRequiredSignInformation.Visible = ConfirmationAnswers.No;
            }
            return allFloorsContentsLabelRequiredSignInformation;
        }
        return base.ConvertFrom(context, culture, value);
    }
}
  • 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-12T23:20:00+00:00Added an answer on June 12, 2026 at 11:20 pm

    Your property has only a “Get”, so it’s read only. Try adding a “Set” property:

    [Category("Data")]
    [DisplayName("Required Sign")]
    [Description("Required Signnnnnnnnnnnnnnn")]
    [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
    public AllFloorsContentsLabelRequiredSignInformation AllFloorsContentsLabelRequiredSignInfo {
      get {
        return allFloorsContentsLabelRequiredSignInformation;
      }
      set {
        allFloorsContentsLabelRequiredSignInformation = value;
      }
    }
    

    Your ConvertFrom has issues where it needs to do more error checking.

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

Sidebar

Related Questions

I've created a custom user control that has several properties. One specifies which database
I have created a custom control but I can't bind a property to the
I have created a Dynamic View Panel custom control and want to add a
I have created a custom user control that is meant to extend the functionality
I know that if I created a custom control, say MyLabel in App_Code ..
Basically, I have created a custom control that uses an UpdatePanel, and as I
I am working on a custom control and have created a property in property
I have a custom composite control that contains a text box, some validators, as
I know how to create a custom user control in WPF but how can
Suppose I created a custom web application that consists of: several assembly DLLs: web

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.