PropertyEditor - access to edited property

Grids for WPF Forum

Posted 16 years ago by Aleksander Brzozowski
Version: 4.5.0470
I have a class:
public MyPropertyClass MyPropertyName //MyProperty
... //set, get

I create property editor and add to PropertyGrid.PropertyEditors :
PropertyEditor pe = new PropertyEditor();
pe.PropertyName = "MyPropertyName";
pe.PropertyType = typeof(MyPropertyClass);
pe.ValueTemplate = MyPropertyTemplate;
propertyGrid.SelectedObject = new EditableInPropertyGirdClass();

MyPropertyTemplate has a button
<Button Grid.Column="1" Click="Button_Click" />

After Click a button(Button_Click) I`d like show my own window to property edit.
Question is - how can I send my property value to window?
From where I can get "MyPropertyName" value?

Thank for any suggestions

Comments (2)

Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Hi Aleksander,

The Property Editors Quick Start in the sample browser shows two examples of using dialogs from custom property editors. In essence, you need to search up the visual tree for an instance of propgrid:IPropertyDataAccessor, which provides access to the underyling property.

In your case, you could use something like:

Button button = (Button)sender;
IPropertyDataAccessor accessor = VisualTreeHelperExtended.GetAncestor(button,
    typeof(IPropertyDataAccessor)) as IPropertyDataAccessor;
// TODO: Update property using accessor.Value

Actipro Software Support

Posted 16 years ago by Aleksander Brzozowski
It works:)
Thanks a lot!!!
The latest build of this product (v24.1.2) was released 27 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.