tgjones / gemini

Gemini is an IDE framework similar in concept to the Visual Studio Shell. It uses AvalonDock and has an MVVM architecture based on Caliburn Micro.
Other
1.1k stars 298 forks source link

Is it possible to style or otherwise modify the LayoutDocumentTabItem? #278

Open chris-ott opened 7 years ago

chris-ott commented 7 years ago

I would like to customize the DockingManager's DocumentPane TabItem controls. I've tried creating a custom style that targets the LayoutDocumentTabItem in a ResourceDictionary in my App.xaml file but the style is being overriden after loading. I also tried to override the DockingManager's DocumentPaneControlStyle value via a custom style in App.xaml but the default styling still overrides most of the values I'm attempting to set. Finally, I tried customizing the DockingManager's DocumentHeaderTemplateSelector via styling. This was marginally successful but the DataContext doesn't seem to be presenting the Title or IconSource.

I was successful in customizing the control within the Gemini library via ShellView.xaml, mainly to validate my efforts but I would prefer to not have to modify Gemini, if possible. I would also like to avoid co-opting the IconSource but I could not find a way to bind a set a separate DataContext within my DataTemplate when using DocumentHeaderTemplateSelector.

Here is the markup that was successful in ShellView.xaml but fails as a style override in App.xaml. It requires a HeaderTemplateSelector class in Gemini\Shell\Controls which is basically a copy of PanesTemplateSelector.cs.

<xcad:DockingManager.DocumentHeaderTemplateSelector>
    <controls:HeaderTemplateSelector>
        <controls:HeaderTemplateSelector.HeaderTemplate>
            <DataTemplate>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <Image Source="{Binding IconSource}"/>
                    <TextBlock Grid.Column="1" Text="{Binding Title}"/>
                </Grid>
            </DataTemplate>
        </controls:HeaderTemplateSelector.HeaderTemplate>
    </controls:HeaderTemplateSelector>
</xcad:DockingManager.DocumentHeaderTemplateSelector>

Any insight would be greatly appreciated. I tried searching out assistance on StackOverflow but the gemini tag isn't related to this project and most of the AvalonDock styling assistance is geared toward direct calls and declarations of the DockingManager, which is how I ended up in ShellView.xaml.