To AutoHide a ToolWindow causes contained PropertyGrid ComboBox to lose values.

Grids for WPF Forum

Posted 9 years ago by Chris Carter
Version: 15.1.0620
Avatar

.NET 4
Actipro WPF Controls v14.2.0610

I have ToolWindows which contain PropertyGrids which display multiple enums (ComboBoxes). When I AutoHide (pin) a ToolWindow, its contained PropertyGrids forget the values of all enum fields and gain red outlines.

Is this due to this other problem, or what might be the issue? http://www.actiprosoftware.com/community/thread/5273/property-grid-losing-data

[Modified 9 years ago]

Comments (4)

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

Hi Chris,

Are you by chance using a {Binding} in your PropertyGrid?  It could be that the DataContext is lost as the tool window moves outside of the main window and into auto-hide?  That issue is generally fixed by using ElementName in your Binding instead of inheriting down the DataContext.


Actipro Software Support

Posted 9 years ago by Chris Carter
Avatar

Yep, I'm using DataContext and simple bindings as described. Is ElementName the only way forward? Not even Source will work? ElementName will require me to do a significant redesign of how data should propagate.

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

Well the problem is that DataContexts normally inherit down the element tree.  As soon as you pull a tool window out into auto-hide or a floating window, that inheritance gets broken.  By using ElementName references, it retains the references.  You could probably even just bind each ToolWindow's DataContext property to the DockSite's DataContext and that would likely work and allow you to keep your child control bindings the same.

For example:

<docking:ToolWindow DataContext="{Binding ElementName=dockSite, Path=DataContext}">...


Actipro Software Support

Posted 9 years ago by Chris Carter
Avatar

Awesome, many thanks. I made that edit and the problem is gone. I had thought you intended me to expose the enums in a new XAML element.

[Modified 9 years ago]

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.