Question

I'm creating a control with properties of type System.Net.IPAddress. The designer shows these as read-only, and seems to be matching them up with resources. Is there a way to make it so that the user can edit these properties in the designer properties window, rather than having to open up the resource editor?

Was it helpful?

Solution

Found it - the answer is to fake it:

[Browsable(true)]
[DisplayName("IPAddress")]
public string IPAddressText
{
    get { return this.IPAddress.ToString(); }
    set { this.IPAddress = IPAddress.Parse(value); }
}

[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public IPAddress IPAddress
{
    get;
    set;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top