Problem

DialogTextBoxPropertyEditor ignores PropertyGrid.IsReadOnly

Posted 4 years ago by Avatar SledgeHammer01
I defined a property like this:

[Category("Starting Page Filter"), DisplayName("Valid Images")]
[Description("Path to images that match this template.")]
[Editor(typeof(DialogTextBoxPropertyEditor), typeof(PropertyEditor))]
public String ValidImagesStart
{
get
{
return _template.ValidImagesStart;
}

set
{
_template.ValidImagesStart = value;
SyncCOMObject();
}
}

I point the property grid to the object that contains this property. Everything works fine.

I add propGrid.IsReadOnly in the code behind and all the built in properties go to read-only mode as expected. The DialogTextBoxPropertyEditor items remain enabled.

Actually, its just the button thats not disabled.

[Modified at 08/25/2010 06:05 PM]

Comments (2)

Posted 4 years ago by Actipro Software Support - Cleveland, OH, USA
Hello,

The DialogTextBoxPropertyEditor is meant to be as flexible as possible. There are cases where it is desireable to display a dialog even for read-only properties. Such as displaying more information about the property, possibly in a read-only fashion, or to possibly make the property read/write.

In any event, we simply expose the the command (PropertyGrid.ShowPropertyDialogCommand) used by the DialogTextBoxPropertyEditor button. You can then register to handle CanExecute and Execute any way you want. The Property Editors QuickStart shows an example of how this is done, but that example always sets e.CanExecute to true. You'd probably want to set it to "!property.IsReadOnly".

Actipro Software Support
Posted 4 years ago by SledgeHammer01
Ah, heh... that would have been easier then modifying the data template.
Information The latest build of this product (2014.2 build 0610) was released 11 days ago, which was after the last post in this thread.

Add a Comment

Please log in to a validated account to post comments.