Hi,
I'm having a weird problem in the dock manager, using the latest version (2009.2). I've been using it for over a year and never experienced this before:
I have a user control which contains a dock manager. Its panes and the DocumentControlHost all contain user controls (all WPF controls - no WinForms stuff.) *Sometimes* when I open the control, the DocumentControlHost is not displayed: No tab, no content. Start the application again, and then it shows up. It might work a few times in a row, then stop again(!)
Thinking the control in the DocumentControlHost could be the problem, I created a test user control with only a textbox in it, and experienced the same kind of behaviour.
The only difference between this one and the others (which do not seem to be exhibiting this behaviour so far) is that this control is instantiated in code-behind, on demand. The others are instantiated at application startup. This one here is not used on a regular basis, so I only instantiate it on demand to save memory.
The dock manager declaration in XAML is basically the same as with my other controls (the ones that work fine), save of course for the actual controls displayed within the panes.
I've been running in circles for a couple of days now and I'm running out of ideas of what to try. The intermittent nature of the problem makes it even harder to debug (I thought I had resolved it a couple of times, only for it to reappear later...)
Suggestions?
Thanks,MIchel
Could you possibly post a sample of the problem or at least a snippet of how you are creating the control in code and some info about where the xamDockManager will be hosted? There was a fix to ensure that ContentPanes that are not referenced within the dockmanager are removed so maybe that is related. There was one issue regarding that fix that was recently reported and will be in this next hotfix where if you had a xamDockManager on a TabControl in a tab that was not selected, unpinned panes were being removed. The workaround I gave for that issue was to force the template of the xamDockManager to be applied (using the ApplyTemplate method).
The XamDockManager is in a grid in a UserControl (no other content in the grid.) I have a couple of other similar controls (all instantiated through XAML, however) that are defined the same way and work fine.
Here's the XAML definition of the Dock Manager (sorry, I have no idea how to post formatted code here). More comments plus some code-behind will follow this:
<igDock:XamDockManager x:Name="UserRequestsDockManager" Theme="{Binding Path=Theme, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:UserRequestsControl}}}" PaneDragStarting="UserRequestsDockManager_PaneDragStarting" PaneNavigatorButtonDisplayMode="Never" > <!-- The document area - Holds User Request Details --> <igDock:DocumentContentHost> <igDock:SplitPane x:Name="UserRequestDocumentSplitPane" Visibility="Visible"> <igDock:TabGroupPane x:Name="UserRequestDocumentTabGroupPane" Visibility="Visible" > <igDock:ContentPane x:Name="UserRequestPane" Tag="{Loc Dock_UserRequestDetails_PaneHeader}" Header="{Loc Dock_UserRequestDetails_PaneHeader}" Image="..\Images\icons\DockManager\descriptors_16x16.png" HorizontalAlignment="Left" VerticalAlignment="Top" Visibility="Visible" Closed="ContentPane_Closed" > <local:UserRequestsDetails x:Name="UserRequestsWindow" Visibility="Visible" Width="{Binding ElementName=UserRequestPane, Path=ActualWidth}" Height="{Binding ElementName=UserRequestPane, Path=ActualHeight}" DataContext="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:UserRequestsControl}, AncestorLevel=1}, Path=RequestInformation}" /> </igDock:ContentPane> </igDock:TabGroupPane> </igDock:SplitPane> </igDock:DocumentContentHost> <igDock:XamDockManager.Panes> <!-- Filter Pane, initially docked to the left This pane is declared first so that it takes up the full height. --> <igDock:SplitPane igDock:XamDockManager.InitialLocation="DockedLeft" x:Name="FilterSplitPane" > <igDock:ContentPane x:Name="UserRequestFilterPane" Closed="ContentPane_Closed" Header="{Loc UserRequestFilter_SearchFilter_Label}" Tag="{Loc UserRequestFilter_SearchFilter_Label}" > <local:UserRequestFilter x:Name="UserRequestFilterWindow" Theme="{Binding Path=Theme, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:UserRequestsControl}}}" DomainId="{Binding Path=DomainId, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:UserRequestsControl}}}" AppLanguage="{Binding Path=AppLanguage, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:UserRequestsControl}}}" DataContext="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:UserRequestsControl}, AncestorLevel=1}, Path=RequestSearchFilter}" /> </igDock:ContentPane> </igDock:SplitPane> <igDock:SplitPane x:Name="TopSplitPane" igDock:XamDockManager.InitialLocation="DockedTop" SplitterOrientation="Vertical" > <igDock:ContentPane igDock:SplitPane.RelativeSize="60,60" x:Name="UserRequestListPane" Image="..\Images\icons\DockManager\descriptorsearch_16x16.png" Tag="{Loc Dock_UserRequestList_PaneHeader}" Header="{Loc Dock_UserRequestList_PaneHeader}" CloseAction="HidePane" Closed="ContentPane_Closed" > <local:UserRequestsList x:Name="UserRequestsListWindow" DataContext="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:UserRequestsControl}, AncestorLevel=1}, Path=RequestList}" MinHeight="20" AppLanguage="{Binding Path=AppLanguage, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:UserRequestsControl}}}" /> </igDock:ContentPane> </igDock:SplitPane> <!-- Bottom split pane - Holds User Request Events --> <igDock:SplitPane x:Name="UserRequestEventsSplitPane" igDock:XamDockManager.InitialLocation="DockedBottom" > <igDock:ContentPane x:Name="UserRequestEventsPane" Image="..\Images\icons\DockManager\itemdetails_active_16x16.png" Tag="{Loc Dock_UserRequestEvents_PaneHeader}" Header="{Loc Dock_UserRequestEvents_PaneHeader}" Closed="ContentPane_Closed" > <local:UserRequestEvents x:Name="UserRequestEventsWindow" MinHeight="20" DataContext="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:UserRequestsControl}, AncestorLevel=1}, Path=RequestInformation}" > </local:UserRequestEvents> </igDock:ContentPane> </igDock:SplitPane> </igDock:XamDockManager.Panes></igDock:XamDockManager>
The "UserRequestDetails" control is the one not showing up - or I should say, that shows up only when it feels like it.
Here's how I instantiate it in code-behind (I'm sure there's a better way to do this, but could not find anything, so this "works" for now:)
_rulingRequests = New UserRequestsControl(UserRequestsControl.RequestType.Ruling) Dim _themeBinding As Binding = New Binding("Theme") _themeBinding.ElementName = "CCSWPFRibbon" BindingOperations.SetBinding(_rulingRequests, UserRequestsControl.ThemeProperty, _themeBinding) Dim _layoutLockedBinding As Binding = New Binding("IsLayoutLocked") _layoutLockedBinding.ElementName = "CCSMainWindow" BindingOperations.SetBinding(_rulingRequests, UserRequestsControl.IsLayoutLockedProperty, _layoutLockedBinding) Dim _appLanguageBinding As Binding = New Binding("ApplicationLanguage") _appLanguageBinding.Source = Application.Current BindingOperations.SetBinding(_rulingRequests, UserRequestsControl.AppLanguageProperty, _appLanguageBinding) 'Dim _domainIdBinding As Binding = New Binding("DomainId") '_domainIdBinding.ElementName = "CCSMainWindow" 'BindingOperations.SetBinding(_rulingRequests, UserRequestsControl.DomainIdProperty, _domainIdBinding) MainWindowGrid.Children.Add(_rulingRequests)
"MainWindowGrid" is a grid in the main window (right... :)) which contains two rows: The first has a XamRibbon, the second has whatever user control is "current" (the other ones are collapsed.) I set Grid.Row="1" in the XAML for the user control, so it appears in the right place - it's just the document (UserRequestDetail) that doesn't show up. As I mentioned in the other post, I don't think UserRequestDetail is the problem, since even a simple control with only a textbox in it exhibits the same behaviour.
I tried adding a call to ApplyTemplate at the end of the code-behind code, no luck (though there was some false hope for a couple of minutes.) Maybe that should go elsewhere (if it's in any way related.)
This is seriously bugging me since this new functionality is due in about two weeks from now.
Thanks,Michel
Thanks for all the information. I was able to piece together a sample that reproduces the problem and will submit the issue. From the snippet it would seem that you are creating a Theme property on your usercontrol and I'm guessing you're doing this by using our ThemeManager.Theme attached property. I'm guessing you're setting the Theme on your usercontrol just as a means of propogating the Theme value and so trying to keep all the controls having their Theme set to the same value and not really expecting to use those resources for the usercontrol itself. If that's the case then one workaround may be to not use our property but define your own string property named Theme. Setting our Theme property means that additional ResourceDictionaries are being put into the resources of that UserControl and that seems to at least be contributing to the timing issue that is leading to the problem. Ultimately this is a problem in the xamDockManager and it will be addressed but perhaps this can help you to continue for now until a hotfix is available. Another option would be to set all the Theme properties to "[current]" and then setting ThemeManager.CurrentTheme in code instead.
Glad to know you were able to reproduce this.
Regarding the theme: I set the theme at the ribbon level. The user controls all have a *string* property named "Theme", which ultimately binds to the ribbon's theme property. Is that what you're describing above?
Yes that was what I was describing. If that's what you're doing then your workaround is probably your best option for now. When I reproduced it I found it happened consistently when I had essentially set a theme on the containing usercontrol. This seems to be a timing issue relating to ContentPanes within the DocumentContentHost.
Yeah, the timing issue would explain why it's somewhat intermittent - pretty much depends on how fast things are happening during a specific run, basically.
My workaround seems to be holding so far - I haven't "lost" my content pane since implementing it. For now I'll just document it in code as a workaround.