Hello!
My application displays objects inside a PropertyGrid. These objects can either have one or multiple values which may vary during runtime (and their display-time). When an object has multiple values, I want to display them in a pop-up. Single values shall be directly displayed in a TextBlock which is part of the PartEditBox. For this to work, I want to dynamically display the DropDownButton.
This is a part of my editor's XAML code:
<editors:PartEditBox
Name="EditBox"
BorderThickness="0"
DropDownButtonVisibility="{Binding Path=MyObject.IsMultiValue, ElementName=EditorRoot, Mode=OneWay,
UpdateSourceTrigger=PropertyChanged, Converter={StaticResource ResourceKey=Bool2Visibility}}"
DropDownStaysOpen="False"
DropDownContentTemplate="{StaticResource ResourceKey=DropDownContent}"
MinDropDownWidth="250"
MinDropDownHeight="150"
MaxDropDownHeight="250"
MaxDropDownWidth="250">
<TextBlock
editors:PartEditBox.ItemPlacementSlot="Center"
Text="{Binding Path=MyObject.Value, ElementName=EditorRoot, Mode=TwoWay}"
HorizontalAlignment="Left"
VerticalAlignment="Center" />
</editors:PartEditBox>
The above code works fine when the IsMultiValue-property does not change while the object is displayed on the PropertyGrid. But when IsMultiValue changes while the object is displayed in the PropertyGrid, I cannot see a difference regarding the DropDownButton.
I assume that the binding is not broken because:
- the content of the TextBlock changes when the object's values change
- when I de-select the to-be-displayed object and re-select it (so the PropertyGrid initializes again), the DropDownButton gets displayed.
- the console does not display any errors
Thank you for your help,
Till