You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I set the ActiveContext of DockingManager codewise with the view model of my documents (passed via binding in DocumentsSource), the focus is not switched to the page in the UI even I use Mode=TwoWay binding.
But when I set ActiveContext of DockingManager with the LayoutDocumentPane class of the page, the focus is set. But that does not make sense in my opinion because the ActiveContext is set with the view model by the UI control (DockingManager) itself.
Here my XAML code:
<avalonDock:DockingManager Grid.Column="2"DocumentsSource="{Binding DocumentPages}"AnchorablesSource="{Binding DetailPages}"ActiveContent="{Binding ActiveDocPage, Mode=TwoWay}">
<avalonDock:DockingManager.LayoutItemTemplateSelector>
<kapok:PageTemplateSelector />
</avalonDock:DockingManager.LayoutItemTemplateSelector>
<avalonDock:DockingManager.LayoutItemContainerStyle>
<!-- you can add additional bindings from the LayoutItem to the DockWindowViewModel -->
<StyleTargetType="{x:Type avalonDock:LayoutItem}">
<SetterProperty="Title"Value="{Binding Model.Title}" />
<SetterProperty="CanClose"Value="{Binding Model.CanClose, FallbackValue=True}" />
<SetterProperty="CloseCommand"Value="{Binding Model.CloseAction, Converter={StaticResource IActionToICommandConverter}, Mode=OneTime}" />
</Style>
</avalonDock:DockingManager.LayoutItemContainerStyle>
<avalonDock:LayoutRoot>
<avalonDock:LayoutPanel>
<!-- default place for the main page(s) -->
<avalonDock:LayoutDocumentPane />
<!-- default place for detail pages -->
<avalonDock:LayoutAnchorablePaneGroup />
</avalonDock:LayoutPanel>
</avalonDock:LayoutRoot>
</avalonDock:DockingManager>
Here my code I use to set the focus on a document:
publicvirtualvoidFocusDocumentPage(DocumentPageCollectionPagehostPage,IPagedocumentPage){varwindow= GetOwnerWindow(hostPage);vardockingManager= window.FindVisualChildren<DockingManager>()?.FirstOrDefault()??thrownew NotSupportedException("Could not get the avalon dock DockingManager");varfirstDocumentPane= dockingManager.Layout.Descendents().OfType<LayoutDocumentPane>().FirstOrDefault();if(firstDocumentPane!=null){vardocumentPageLayoutDocument= firstDocumentPane.Children.FirstOrDefault(layoutDocument => layoutDocument.Content ==documentPage);// We cannot set the view model but must set the LayoutDocument object
dockingManager.ActiveContent =documentPageLayoutDocument;}}
p.s. DocumentPageCollectionPage and IPage are my view models.
The text was updated successfully, but these errors were encountered:
When I set the
ActiveContext
ofDockingManager
codewise with the view model of my documents (passed via binding inDocumentsSource
), the focus is not switched to the page in the UI even I useMode=TwoWay
binding.But when I set
ActiveContext
ofDockingManager
with theLayoutDocumentPane
class of the page, the focus is set. But that does not make sense in my opinion because theActiveContext
is set with the view model by the UI control (DockingManager) itself.Here my XAML code:
Here my code I use to set the focus on a document:
p.s.
DocumentPageCollectionPage
andIPage
are my view models.The text was updated successfully, but these errors were encountered: