Posted 15 years ago
by jeff jarrell
The properties that I am putting up into the property grid is a dynamic list of property objects assembled into a collection.
I am using the PropertyGrid.SelectedObject(s). I have a derived DataFactory creating instances of something that implements IPropertyDataAccessor.
I am looking at something simple like the DoubleEditBox. It's not a PropertyEditor per-se so I derive a class from PropertyEditor and override the ValueTemplate property. Here I do an Application.Current.FindResource and provide the DataTemplate. The ProperyEditor is defined in xaml and added to the BuiltInEditors.
The DataTemplate at this point includes a reference to DoubleEditBox and has bindings to the IPropertyDataAccessor.Value.1) This seems to work, but is this the proper way to create and provide a PropertyEditor in this scenario.
2) It doesn't look right as it has a border around the control in the property grid, even when the cell doesn't have focus. How do I get rid of this extra border?
3) I'd expect that I need to include a binding to the IPropertyDataAccessor.IsReadOnly, which is easy enough, but how should a change to the business object.IsEnabled bubble up. Since there is only a Getter on the IPropertyDataAccessor i need to create something like a SetEnabled() on the object that implements IPropertyDataAccessor. True?
4) Of course, if there is an example in the docs that I missed, I'd be happy for a reference.
Thanks for any help.
jeff
I am using the PropertyGrid.SelectedObject(s). I have a derived DataFactory creating instances of something that implements IPropertyDataAccessor.
I am looking at something simple like the DoubleEditBox. It's not a PropertyEditor per-se so I derive a class from PropertyEditor and override the ValueTemplate property. Here I do an Application.Current.FindResource and provide the DataTemplate. The ProperyEditor is defined in xaml and added to the BuiltInEditors.
The DataTemplate at this point includes a reference to DoubleEditBox and has bindings to the IPropertyDataAccessor.Value.
<DataTemplate x:Key="doublePropertyEditor">
<acteditors:DoubleEditBox Name="textBox"
Value="{Binding Value, RelativeSource={RelativeSource AncestorType={x:Type propgrid:IPropertyDataAccessor}}, Mode=TwoWay}"
/>
2) It doesn't look right as it has a border around the control in the property grid, even when the cell doesn't have focus. How do I get rid of this extra border?
3) I'd expect that I need to include a binding to the IPropertyDataAccessor.IsReadOnly, which is easy enough, but how should a change to the business object.IsEnabled bubble up. Since there is only a Getter on the IPropertyDataAccessor i need to create something like a SetEnabled() on the object that implements IPropertyDataAccessor. True?
4) Of course, if there is an example in the docs that I missed, I'd be happy for a reference.
Thanks for any help.
jeff