DialogTextBoxPropertyEditor ignores PropertyGrid.IsReadOnly

Grids for WPF Forum

Posted 14 years ago by SledgeHammer01
Version: 10.1.0523
Platform: .NET 4.0
Environment: Windows XP (32-bit)
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
return _template.ValidImagesStart;

_template.ValidImagesStart = value;

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 14 years ago by Actipro Software Support - Cleveland, OH, USA

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 14 years ago by SledgeHammer01
Ah, heh... that would have been easier then modifying the data template.
The latest build of this product (v24.1.2) was released 26 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.