PartEditBox: Binding to DropDownButtonVisibility does not work on PropertyChanged.

Editors for WPF Forum

Posted 11 years ago by Till
Version: 13.1.0582
Platform: .NET 4.0
Environment: Windows 7 (64-bit)
Avatar

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

Comments (2)

Answer - Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Till,

We do a binding on DropDownButtonVisibility in the PartEditBoxItemVisibility QuickStart and it works ok there.  Please check that out and if that doesn't help you might want to look more at your binding to make sure it's really working correctly.  You could even put a breakpoint in your value converter to see if it ever gets hit after you change the IsMultiValue.


Actipro Software Support

Posted 11 years ago by Till
Avatar

Hi.

I found the problem. The property-name in the PropertyChangedEventArgs had a typo... The binding works fine now.

Thanks,

   Till

The latest build of this product (v24.1.1) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.