I have a control that utilizes an AvalonDock (v2) __DockingManager__ control for displaying a set of documents managed by an underlying view model:
```
<avalonDock:DockingManager DocumentsSource="{Binding Items}">
<avalonDock:DockingManager.LayoutItemContainerStyle>
<Style TargetType="{x:Type avalonDockControls:LayoutItem}" BasedOn="{StaticResource DocumentItem}"/>
</avalonDock:DockingManager.LayoutItemContainerStyle>
<avalonDockLayout:LayoutRoot>
<avalonDockLayout:LayoutPanel Orientation="Horizontal">
<avalonDockLayout:LayoutDocumentPane/>
</avalonDockLayout:LayoutPanel>
</avalonDockLayout:LayoutRoot>
</avalonDock:DockingManager>
```
The document view model has an __IsSelected__ property, and when the view model is selected, I want to select and show the document in the __DockingManager__. To do this, I updated the Style for __LayoutItem__ as follows:
```
<Style x:Key="DocumentItem" TargetType="{x:Type avalonDockControls:LayoutItem}">
<Setter Property="Title" Value="{Binding Model.TabTitle}"/>
<Setter Property="IsSelected" Value="{Binding Model.IsSelected, Mode=TwoWay}"/>
</Style>
```
This approach works fine when the control is hosted within a WPF application, but when the control is hosted within a VSPackage, selecting the document in the view model more often than not does not bring the selected document into view.
I doubt that the issue is in the view model layer or the VSPackage itself, as when the control utilized a TabControl, the selected document always showed on top.
Is there a better, still MVVM friendly approach to get the selected document in an AvalonDock __DockingManager__ to show under all circumstances?
```
<avalonDock:DockingManager DocumentsSource="{Binding Items}">
<avalonDock:DockingManager.LayoutItemContainerStyle>
<Style TargetType="{x:Type avalonDockControls:LayoutItem}" BasedOn="{StaticResource DocumentItem}"/>
</avalonDock:DockingManager.LayoutItemContainerStyle>
<avalonDockLayout:LayoutRoot>
<avalonDockLayout:LayoutPanel Orientation="Horizontal">
<avalonDockLayout:LayoutDocumentPane/>
</avalonDockLayout:LayoutPanel>
</avalonDockLayout:LayoutRoot>
</avalonDock:DockingManager>
```
The document view model has an __IsSelected__ property, and when the view model is selected, I want to select and show the document in the __DockingManager__. To do this, I updated the Style for __LayoutItem__ as follows:
```
<Style x:Key="DocumentItem" TargetType="{x:Type avalonDockControls:LayoutItem}">
<Setter Property="Title" Value="{Binding Model.TabTitle}"/>
<Setter Property="IsSelected" Value="{Binding Model.IsSelected, Mode=TwoWay}"/>
</Style>
```
This approach works fine when the control is hosted within a WPF application, but when the control is hosted within a VSPackage, selecting the document in the view model more often than not does not bring the selected document into view.
I doubt that the issue is in the view model layer or the VSPackage itself, as when the control utilized a TabControl, the selected document always showed on top.
Is there a better, still MVVM friendly approach to get the selected document in an AvalonDock __DockingManager__ to show under all circumstances?