Quantcast
Channel: AvalonDock
Viewing all articles
Browse latest Browse all 2690

New Post: Version 2 and MVVM Light

$
0
0
Hi,
I'm trying to use the MVVM Light locator (SimpleIoC) with Avalondock.
I do get it running but somehow the StyleSelector is not called and I do not understandy why.
The constructor is called but the Method: SelectStyle is never called.

The view is shown in a proper way and also the bound viewmodel is working very well.

The StyleSelector Class looks as follow:
class PaneStyleSelector : StyleSelector
    {
        public PaneStyleSelector() { }

        public Style StartPageStyle { get; set; }

        public override System.Windows.Style SelectStyle(object item, System.Windows.DependencyObject container)
        {

            if (item is StartPageViewModel)
                return StartPageStyle;


            return base.SelectStyle(item, container);
        }
    }
The MainWindow Xaml:
<avalonDock:DockingManager Name="dockManager"
                                   AnchorablesSource="{Binding Tools}"
                                   DocumentsSource="{Binding Files}"
                                   ActiveContent="{Binding ActiveDocument, Mode=TwoWay, Converter={StaticResource ActiveDocumentConverter}}"
                                   Grid.Row="1">
            <avalonDock:DockingManager.LayoutItemTemplateSelector>
                <pane:PanesTemplateSelector>
                    <pane:PanesTemplateSelector.StartPageViewTemplate>
                        <DataTemplate>
                            <view:StartPageView/>
                        </DataTemplate>
                    </pane:PanesTemplateSelector.StartPageViewTemplate>
                </pane:PanesTemplateSelector>
            </avalonDock:DockingManager.LayoutItemTemplateSelector>
            
            <avalonDock:DockingManager.LayoutItemContainerStyleSelector>
                <pane:PaneStyleSelector>
                    <pane:PaneStyleSelector.StartPageStyle>
                        <Style TargetType="{x:Type avalonDock:LayoutItem}">
                            <Setter Property="Title" Value="{Binding Model.Title}"/>
                            <Setter Property="ToolTip" Value="{Binding Model.StartPageTip}"/>
                            <Setter Property="CloseCommand" Value="{Binding Model.CloseCommand}"/>
                            <Setter Property="IconSource" Value="{Binding Model.IconSource}"/>
                            <Setter Property="ContentId" Value="{Binding Model.ContentId}"/>
                        </Style>
                    </pane:PaneStyleSelector.StartPageStyle>
                </pane:PaneStyleSelector>
            </avalonDock:DockingManager.LayoutItemContainerStyleSelector>
        </avalonDock:DockingManager>
Does anyone have an idea whats wrong with the PaneStyleSelector? References are give, intellisense also sees the "StartPageStyle". The Binding to "Model.Title" and so on is not working here....

Please let me know if any further information is required.
Many Thanks!!

Viewing all articles
Browse latest Browse all 2690

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>