Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
90
SelectedObjects and Values displayed with custom editors
posted

I have a XamPropertyGrid that is displaying properties for multiple objects using the SelectedObjects property. For default controls that represent a property, check box for a bool property for example, the control is able to display an indeterminate state when the properties have both true and false values. How can I accomplish this for my own custom controls I provide in a PropertyGridEditorDefinition? I've provided a sample of one of my definitions below. Thanks!

<ig:PropertyGridEditorDefinition TargetType="{x:Type shared:Weight}">
                    <ig:PropertyGridEditorDefinition.EditTemplate>
                        <DataTemplate>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*" />
                                    <ColumnDefinition Width="Auto" />
                                </Grid.ColumnDefinitions>
                                <controls:WeightEditor Grid.Column="0" Margin="5,1,1,1" WeightValue="{Binding Value, Mode=TwoWay}" ValueUpdateSourceTrigger="LostFocus"/>
                            </Grid>
                        </DataTemplate>
                    </ig:PropertyGridEditorDefinition.EditTemplate>
                </ig:PropertyGridEditorDefinition>
Parents
No Data
Reply
  • 17475
    Offline posted

    Hello Richard,

    The PropertyGridEditorDefinition allows you to customize the editor control which will be used in the XamPropertyGrid control. Since you are using the custom WeightEditor controll defined in your application, it should have the three state support defined in order to display correctly when different values are provided by the Weight type. By default, the bool property could be defined as nullable type which is supported by the Checkbox so that when a null value is provided the Checkbox is in undetermined state.

    Let me know if you have any questions.


Children