Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Making a property editable ONLY BY CUSTOM EDITOR

0 views
Skip to first unread message

Bill Foust

unread,
Jun 15, 2004, 1:04:25 PM6/15/04
to
I have a property which is a basic type and I have a custom editor on the
property. The value of the property shows up as editable with the "..."
button to launch the custom editor. However I want to PREVENT the user from
editing the value by simply typing it in. I want to force the user to launch
the custom editor. Is there a secret attribute to do this?

Thanks
Bill


Ying-Shen Yu[MSFT]

unread,
Jun 16, 2004, 4:36:40 AM6/16/04
to
Hi Bill,

You may try specifying a Type Converter class for your property,
here is a quick sample shows how to do this, for simplicity I defined a
Property in Font type, you may add this code snippet to a user control then
add the user control to the Form, now the MyFont property displays a string
returned from Font.ToString() and a button with "...", you may edit the
value using Font Dialog but the text field of the property is not editable.

<code>
[
TypeConverter(typeof(TypeConverter))
]
public Font MyFont
{
get
{
return this.Font;
}
set
{
this.Font = value;
}
}
<code>
Does it resolve your probem?
Feel free to reply this thread if you have anything unclear about it.

Have a nice day!


Best regards,

Ying-Shen Yu [MSFT]
Microsoft Community Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
This mail should not be replied directly, please remove the word "online"
before sending mail.

0 new messages