Templating ToolWindowContainer Breaks UI

Docking/MDI for WPF Forum

Posted 6 years ago by Jason Stevenson - Senior Software Architect, Gemvision
Version: 18.1.0671
Platform: .NET 4.7
Environment: Windows 10 (64-bit)
Avatar

After using VS 2017 to generate a Copy of the ToolWindowContainer style, so that we can apply our UI look/feel.  The control template no longer shows our content.

Here I simply created the style, and restarted, without changes the default values, and the content no longer renders.  This is the last thing I need the control to do, in order to get purchase approval.

 

<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:docking="http://schemas.actiprosoftware.com/winfx/xaml/docking"
    xmlns:shared="http://schemas.actiprosoftware.com/winfx/xaml/shared"
    xmlns:themes="http://schemas.actiprosoftware.com/winfx/xaml/themes">
    <Style x:Key="ToolWindowContainerStyleMG" TargetType="{x:Type docking:ToolWindowContainer}">
        <Setter Property="BorderBrush" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolWindowContainerTabItemBorderSelectedBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
        <Setter Property="BorderThickness" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolWindowContainerTabControlBorderNormalThicknessKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
        <Setter Property="CloseButtonContentTemplate" Value="{DynamicResource {ComponentResourceKey ResourceId=CloseGlyphTemplateKey, TypeInTargetAssembly={x:Type themes:SharedResourceKeys}}}" />
        <Setter Property="EmbeddedButtonStyle">
            <Setter.Value>
                <Style TargetType="{x:Type ButtonBase}">
                    <Setter Property="themes:ThemeProperties.CornerRadius" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolWindowTitleBarButtonBorderNormalCornerRadiusKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                    <Style.BasedOn>
                        <Style TargetType="{x:Type ButtonBase}">
                            <Setter Property="Padding" Value="2" />
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="{x:Type ButtonBase}">
                                        <Border
                                            x:Name="outerBorder"
                                            Background="{TemplateBinding Background}"
                                            BorderBrush="{TemplateBinding BorderBrush}"
                                            BorderThickness="{TemplateBinding BorderThickness}"
                                            CornerRadius="{TemplateBinding themes:ThemeProperties.CornerRadius}"
                                            SnapsToDevicePixels="True">
                                            <Grid>
                                                <Border
                                                    x:Name="innerBorder"
                                                    BorderBrush="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonInnerBorderNormalBrushKey,
                                                                                                        TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}"
                                                    BorderThickness="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonBorderNormalThicknessKey,
                                                                                                            TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}"
                                                    CornerRadius="{TemplateBinding themes:ThemeProperties.CornerRadius}"
                                                    SnapsToDevicePixels="True" />
                                                <shared:PixelSnapper VerticalRoundMode="CeilingToEven">
                                                    <ContentPresenter
                                                        x:Name="presenter"
                                                        Margin="{TemplateBinding Padding}"
                                                        HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                        VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                                        Content="{TemplateBinding Content}"
                                                        ContentStringFormat="{TemplateBinding ContentStringFormat}"
                                                        ContentTemplate="{TemplateBinding ContentTemplate}"
                                                        Opacity="0.75"
                                                        SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                                                </shared:PixelSnapper>
                                            </Grid>
                                        </Border>
                                        <ControlTemplate.Triggers>
                                            <Trigger Property="ToggleButton.IsChecked" Value="True">
                                                <Setter TargetName="outerBorder" Property="Background" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonBackgroundCheckedNormalBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                                                <Setter TargetName="outerBorder" Property="BorderBrush" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonBorderCheckedNormalBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                                                <Setter TargetName="innerBorder" Property="BorderBrush" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonInnerBorderCheckedNormalBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                                                <Setter TargetName="presenter" Property="TextElement.Foreground" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonForegroundHoverBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                                            </Trigger>
                                            <Trigger Property="IsMouseOver" Value="True">
                                                <Setter TargetName="outerBorder" Property="Background" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonBackgroundHoverBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                                                <Setter TargetName="outerBorder" Property="BorderBrush" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonBorderHoverBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                                                <Setter TargetName="innerBorder" Property="BorderBrush" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonInnerBorderHoverBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                                                <Setter TargetName="presenter" Property="TextElement.Foreground" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonForegroundHoverBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                                                <Setter TargetName="presenter" Property="Opacity" Value="1" />
                                            </Trigger>
                                            <Trigger Property="IsKeyboardFocused" Value="True">
                                                <Setter TargetName="outerBorder" Property="Background" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonBackgroundHoverBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                                                <Setter TargetName="outerBorder" Property="BorderBrush" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonBorderHoverBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                                                <Setter TargetName="innerBorder" Property="BorderBrush" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonInnerBorderHoverBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                                                <Setter TargetName="presenter" Property="TextElement.Foreground" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonForegroundHoverBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                                                <Setter TargetName="presenter" Property="Opacity" Value="1" />
                                            </Trigger>
                                            <MultiTrigger>
                                                <MultiTrigger.Conditions>
                                                    <Condition Property="IsMouseOver" Value="True" />
                                                    <Condition Property="ToggleButton.IsChecked" Value="True" />
                                                </MultiTrigger.Conditions>
                                                <Setter TargetName="outerBorder" Property="Background" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonBackgroundCheckedHoverBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                                                <Setter TargetName="outerBorder" Property="BorderBrush" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonBorderCheckedHoverBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                                                <Setter TargetName="innerBorder" Property="BorderBrush" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonInnerBorderCheckedHoverBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                                                <Setter TargetName="presenter" Property="TextElement.Foreground" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonForegroundHoverBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                                                <Setter TargetName="presenter" Property="Opacity" Value="1" />
                                            </MultiTrigger>
                                            <MultiTrigger>
                                                <MultiTrigger.Conditions>
                                                    <Condition Property="IsKeyboardFocused" Value="True" />
                                                    <Condition Property="ToggleButton.IsChecked" Value="True" />
                                                </MultiTrigger.Conditions>
                                                <Setter TargetName="outerBorder" Property="Background" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonBackgroundCheckedHoverBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                                                <Setter TargetName="outerBorder" Property="BorderBrush" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonBorderCheckedHoverBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                                                <Setter TargetName="innerBorder" Property="BorderBrush" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonInnerBorderCheckedHoverBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                                                <Setter TargetName="presenter" Property="TextElement.Foreground" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonForegroundHoverBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                                                <Setter TargetName="presenter" Property="Opacity" Value="1" />
                                            </MultiTrigger>
                                            <Trigger Property="IsPressed" Value="True">
                                                <Setter TargetName="outerBorder" Property="Background" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonBackgroundPressedBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                                                <Setter TargetName="outerBorder" Property="BorderBrush" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonBorderPressedBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                                                <Setter TargetName="innerBorder" Property="BorderBrush" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonInnerBorderPressedBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                                                <Setter TargetName="presenter" Property="TextElement.Foreground" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonForegroundHoverBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                                                <Setter TargetName="presenter" Property="Opacity" Value="1" />
                                            </Trigger>
                                            <Trigger Property="IsEnabled" Value="False">
                                                <Setter TargetName="presenter" Property="TextElement.Foreground" Value="{DynamicResource {ComponentResourceKey ResourceId=ControlForegroundDisabledBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                                                <Setter TargetName="presenter" Property="Opacity" Value="{Binding (themes:ThemeProperties.DisabledOpacity), RelativeSource={RelativeSource TemplatedParent}}" />
                                            </Trigger>
                                        </ControlTemplate.Triggers>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                            <Style.BasedOn>
                                <Style TargetType="{x:Type ButtonBase}">
                                    <Setter Property="OverridesDefaultStyle" Value="True" />
                                    <Style.BasedOn>
                                        <Style TargetType="{x:Type ButtonBase}">
                                            <Setter Property="Background" Value="Transparent" />
                                            <Setter Property="BorderBrush" Value="Transparent" />
                                            <Setter Property="BorderThickness" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonBorderNormalThicknessKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                                            <Setter Property="Padding" Value="0" />
                                            <Setter Property="HorizontalAlignment" Value="Center" />
                                            <Setter Property="VerticalAlignment" Value="Center" />
                                            <Setter Property="HorizontalContentAlignment" Value="Center" />
                                            <Setter Property="VerticalContentAlignment" Value="Center" />
                                            <Setter Property="Focusable" Value="False" />
                                            <Setter Property="IsTabStop" Value="False" />
                                            <Setter Property="themes:ThemeProperties.DisabledOpacity" Value="0.4" />
                                            <Setter Property="SnapsToDevicePixels" Value="True" />
                                            <Setter Property="Template">
                                                <Setter.Value>
                                                    <ControlTemplate TargetType="{x:Type ButtonBase}">
                                                        <Border
                                                            x:Name="outerBorder"
                                                            Background="{TemplateBinding Background}"
                                                            BorderBrush="{TemplateBinding BorderBrush}"
                                                            BorderThickness="{TemplateBinding BorderThickness}"
                                                            CornerRadius="{TemplateBinding themes:ThemeProperties.CornerRadius}"
                                                            SnapsToDevicePixels="True">
                                                            <Grid>
                                                                <Border
                                                                    x:Name="innerBorder"
                                                                    BorderBrush="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonInnerBorderNormalBrushKey,
                                                                                                                        TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}"
                                                                    BorderThickness="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonBorderNormalThicknessKey,
                                                                                                                            TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}"
                                                                    CornerRadius="{TemplateBinding themes:ThemeProperties.CornerRadius}"
                                                                    SnapsToDevicePixels="True" />
                                                                <shared:PixelSnapper VerticalRoundMode="CeilingToEven">
                                                                    <ContentPresenter
                                                                        x:Name="presenter"
                                                                        Margin="{TemplateBinding Padding}"
                                                                        HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                                        VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                                                        Content="{TemplateBinding Content}"
                                                                        ContentStringFormat="{TemplateBinding ContentStringFormat}"
                                                                        ContentTemplate="{TemplateBinding ContentTemplate}"
                                                                        SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                                                                </shared:PixelSnapper>
                                                            </Grid>
                                                        </Border>
                                                        <ControlTemplate.Triggers>
                                                            <Trigger Property="ToggleButton.IsChecked" Value="True">
                                                                <Setter TargetName="outerBorder" Property="Background" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonBackgroundCheckedNormalBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                                                                <Setter TargetName="outerBorder" Property="BorderBrush" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonBorderCheckedNormalBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                                                                <Setter TargetName="innerBorder" Property="BorderBrush" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonInnerBorderCheckedNormalBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                                                                <Setter TargetName="presenter" Property="TextElement.Foreground" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonForegroundHoverBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                                                            </Trigger>
                                                            <Trigger Property="IsMouseOver" Value="True">
                                                                <Setter TargetName="outerBorder" Property="Background" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonBackgroundHoverBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                                                                <Setter TargetName="outerBorder" Property="BorderBrush" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonBorderHoverBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                                                                <Setter TargetName="innerBorder" Property="BorderBrush" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonInnerBorderHoverBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                                                                <Setter TargetName="presenter" Property="TextElement.Foreground" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonForegroundHoverBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                                                            </Trigger>
                                                            <Trigger Property="IsKeyboardFocused" Value="True">
                                                                <Setter TargetName="outerBorder" Property="Background" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonBackgroundHoverBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                                                                <Setter TargetName="outerBorder" Property="BorderBrush" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonBorderHoverBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                                                                <Setter TargetName="innerBorder" Property="BorderBrush" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonInnerBorderHoverBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                                                                <Setter TargetName="presenter" Property="TextElement.Foreground" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonForegroundHoverBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                                                            </Trigger>
                                                            <MultiTrigger>
                                                                <MultiTrigger.Conditions>
                                                                    <Condition Property="IsMouseOver" Value="True" />
                                                                    <Condition Property="ToggleButton.IsChecked" Value="True" />
                                                                </MultiTrigger.Conditions>
                                                                <Setter TargetName="outerBorder" Property="Background" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonBackgroundCheckedHoverBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                                                                <Setter TargetName="outerBorder" Property="BorderBrush" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonBorderCheckedHoverBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                                                                <Setter TargetName="innerBorder" Property="BorderBrush" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonInnerBorderCheckedHoverBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                                                                <Setter TargetName="presenter" Property="TextElement.Foreground" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonForegroundHoverBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                                                            </MultiTrigger>
                                                            <MultiTrigger>
                                                                <MultiTrigger.Conditions>
                                                                    <Condition Property="IsKeyboardFocused" Value="True" />
                                                                    <Condition Property="ToggleButton.IsChecked" Value="True" />
                                                                </MultiTrigger.Conditions>
                                                                <Setter TargetName="outerBorder" Property="Background" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonBackgroundCheckedHoverBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                                                                <Setter TargetName="outerBorder" Property="BorderBrush" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonBorderCheckedHoverBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                                                                <Setter TargetName="innerBorder" Property="BorderBrush" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonInnerBorderCheckedHoverBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                                                                <Setter TargetName="presenter" Property="TextElement.Foreground" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonForegroundHoverBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                                                            </MultiTrigger>
                                                            <Trigger Property="IsPressed" Value="True">
                                                                <Setter TargetName="outerBorder" Property="Background" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonBackgroundPressedBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                                                                <Setter TargetName="outerBorder" Property="BorderBrush" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonBorderPressedBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                                                                <Setter TargetName="innerBorder" Property="BorderBrush" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonInnerBorderPressedBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                                                                <Setter TargetName="presenter" Property="TextElement.Foreground" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolBarButtonForegroundHoverBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                                                            </Trigger>
                                                            <Trigger Property="IsEnabled" Value="False">
                                                                <Setter TargetName="presenter" Property="Opacity" Value="{Binding (themes:ThemeProperties.DisabledOpacity), RelativeSource={RelativeSource TemplatedParent}}" />
                                                            </Trigger>
                                                        </ControlTemplate.Triggers>
                                                    </ControlTemplate>
                                                </Setter.Value>
                                            </Setter>
                                        </Style>
                                    </Style.BasedOn>
                                </Style>
                            </Style.BasedOn>
                        </Style>
                    </Style.BasedOn>
                </Style>
            </Setter.Value>
        </Setter>
        <Setter Property="Focusable" Value="False" />
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="HasTitleBarGripper" Value="{DynamicResource {ComponentResourceKey ResourceId=DockingWindowContainerTitleBarHasGripperBooleanKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
        <Setter Property="MaximizeButtonContentTemplate" Value="{DynamicResource {ComponentResourceKey ResourceId=MaximizeGlyphTemplateKey, TypeInTargetAssembly={x:Type themes:SharedResourceKeys}}}" />
        <Setter Property="MenuButtonContentTemplate" Value="{DynamicResource {ComponentResourceKey ResourceId=DropDownArrowGlyphTemplateKey, TypeInTargetAssembly={x:Type themes:SharedResourceKeys}}}" />
        <Setter Property="MinimizeButtonContentTemplate" Value="{DynamicResource {ComponentResourceKey ResourceId=MinimizeGlyphTemplateKey, TypeInTargetAssembly={x:Type themes:SharedResourceKeys}}}" />
        <Setter Property="PinButtonContentTemplate" Value="{DynamicResource {ComponentResourceKey ResourceId=PinGlyphTemplateKey, TypeInTargetAssembly={x:Type themes:SharedResourceKeys}}}" />
        <Setter Property="RestoreButtonContentTemplate" Value="{DynamicResource {ComponentResourceKey ResourceId=RestoreGlyphTemplateKey, TypeInTargetAssembly={x:Type themes:SharedResourceKeys}}}" />
        <Setter Property="TitleFontFamily" Value="{DynamicResource {x:Static SystemFonts.MenuFontFamilyKey}}" />
        <Setter Property="TitleFontSize" Value="{DynamicResource {x:Static SystemFonts.MenuFontSizeKey}}" />
        <Setter Property="UnpinButtonContentTemplate" Value="{DynamicResource {ComponentResourceKey ResourceId=UnpinGlyphTemplateKey, TypeInTargetAssembly={x:Type themes:SharedResourceKeys}}}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type docking:ToolWindowContainer}">
                    <Grid themes:WindowChrome.ElementKind="NonClientArea">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>
                        <Border
                            x:Name="titleBarBorder"
                            themes:WindowChrome.ElementKind="NonClientArea"
                            Background="{DynamicResource {ComponentResourceKey ResourceId=DockingWindowContainerTitleBarBackgroundInactiveBrushKey,
                                                                               TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            CornerRadius="{DynamicResource {ComponentResourceKey ResourceId=DockingWindowContainerTitleBarBorderNormalCornerRadiusKey,
                                                                                 TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}"
                            SnapsToDevicePixels="True"
                            TextElement.Foreground="{DynamicResource {ComponentResourceKey ResourceId=DockingWindowContainerTitleBarGlyphBackgroundInactiveBrushKey,
                                                                                           TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}">
                            <Border.Visibility>
                                <Binding Path="SelectedWindow.HasTitleBarResolved" RelativeSource="{RelativeSource TemplatedParent}">
                                    <Binding.Converter>
                                        <BooleanToVisibilityConverter />
                                    </Binding.Converter>
                                </Binding>
                            </Border.Visibility>
                            <Grid>
                                <Rectangle
                                    x:Name="nonClientTitleBarGripper"
                                    themes:WindowChrome.ElementKind="TitleBar"
                                    Fill="Transparent" />
                                <docking:TitleBarPanel
                                    x:Name="PART_TitleBar"
                                    Margin="2,0"
                                    themes:WindowChrome.ElementKind="NonClientArea"
                                    ClipToBounds="True"
                                    ContextContentAlignment="{TemplateBinding TitleBarContextContentAlignment}">
                                    <Image
                                        x:Name="PART_Icon"
                                        Width="16"
                                        Height="16"
                                        Margin="2,0,0,0"
                                        VerticalAlignment="Center"
                                        docking:TitleBarPanel.IsIcon="True"
                                        SnapsToDevicePixels="True"
                                        Source="{Binding SelectedWindow.ImageSource, RelativeSource={RelativeSource TemplatedParent}}">
                                        <Image.Visibility>
                                            <Binding Path="HasTitleBarIcon" RelativeSource="{RelativeSource TemplatedParent}">
                                                <Binding.Converter>
                                                    <BooleanToVisibilityConverter />
                                                </Binding.Converter>
                                            </Binding>
                                        </Image.Visibility>
                                    </Image>
                                    <TextBlock
                                        x:Name="title"
                                        Margin="3,3,5,3"
                                        VerticalAlignment="Center"
                                        docking:TitleBarPanel.IsHeader="True"
                                        themes:WindowChrome.ElementKind="TitleBar"
                                        FontFamily="{TemplateBinding TitleFontFamily}"
                                        FontSize="{TemplateBinding TitleFontSize}"
                                        FontWeight="{TemplateBinding TitleFontWeight}"
                                        Foreground="{DynamicResource {ComponentResourceKey ResourceId=DockingWindowContainerTitleBarForegroundInactiveBrushKey,
                                                                                           TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}"
                                        Text="{Binding SelectedWindow.Title, RelativeSource={RelativeSource TemplatedParent}}"
                                        TextTrimming="CharacterEllipsis"
                                        TextWrapping="NoWrap" />
                                    <Rectangle
                                        x:Name="titleBarGripper"
                                        Height="5"
                                        Margin="4,1,4,0"
                                        VerticalAlignment="Center"
                                        docking:TitleBarPanel.IsFiller="True"
                                        themes:WindowChrome.ElementKind="TitleBar"
                                        Opacity="0.5"
                                        SnapsToDevicePixels="True"
                                        UseLayoutRounding="True">
                                        <Rectangle.Fill>
                                            <DrawingBrush
                                                TileMode="Tile"
                                                Viewbox="0,0,4,5"
                                                ViewboxUnits="Absolute"
                                                Viewport="0,0,4,5"
                                                ViewportUnits="Absolute">
                                                <DrawingBrush.Drawing>
                                                    <GeometryDrawing Brush="{DynamicResource {ComponentResourceKey ResourceId=DockingWindowContainerTitleBarForegroundInactiveBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}">
                                                        <GeometryDrawing.Geometry>
                                                            <GeometryGroup>
                                                                <RectangleGeometry Rect="0,0,1,1" />
                                                                <RectangleGeometry Rect="2,2,1,1" />
                                                                <RectangleGeometry Rect="0,4,1,1" />
                                                            </GeometryGroup>
                                                        </GeometryDrawing.Geometry>
                                                    </GeometryDrawing>
                                                </DrawingBrush.Drawing>
                                            </DrawingBrush>
                                        </Rectangle.Fill>
                                        <Rectangle.Visibility>
                                            <Binding Path="HasTitleBarGripper" RelativeSource="{RelativeSource TemplatedParent}">
                                                <Binding.Converter>
                                                    <BooleanToVisibilityConverter />
                                                </Binding.Converter>
                                            </Binding>
                                        </Rectangle.Visibility>
                                    </Rectangle>
                                    <ContentPresenter
                                        VerticalAlignment="Center"
                                        docking:TitleBarPanel.IsContextContent="True"
                                        themes:WindowChrome.ElementKind="ClientArea"
                                        Content="{Binding SelectedWindow.DataContext, RelativeSource={RelativeSource TemplatedParent}}"
                                        ContentTemplate="{Binding SelectedWindow.ToolWindowContainerTitleBarContextContentTemplate, RelativeSource={RelativeSource TemplatedParent}}" />
                                    <Button
                                        x:Name="PART_OptionsButton"
                                        VerticalAlignment="Center"
                                        themes:WindowChrome.ElementKind="ClientArea"
                                        AutomationProperties.Name="Options"
                                        ClickMode="Press"
                                        Command="{Binding OpenOptionsMenuCommand, RelativeSource={RelativeSource TemplatedParent}}"
                                        ContentTemplate="{TemplateBinding MenuButtonContentTemplate}"
                                        Style="{TemplateBinding EmbeddedButtonStyle}"
                                        ToolTip="Options">
                                        <Button.Visibility>
                                            <Binding Path="IsOptionsButtonVisible" RelativeSource="{RelativeSource TemplatedParent}">
                                                <Binding.Converter>
                                                    <BooleanToVisibilityConverter />
                                                </Binding.Converter>
                                            </Binding>
                                        </Button.Visibility>
                                    </Button>
                                    <Button
                                        x:Name="toggleAutoHideButton"
                                        VerticalAlignment="Center"
                                        themes:WindowChrome.ElementKind="ClientArea"
                                        AutomationProperties.Name="ToggleAutoHide"
                                        Command="{Binding ToggleAutoHideCommand, RelativeSource={RelativeSource TemplatedParent}}"
                                        ContentTemplate="{TemplateBinding UnpinButtonContentTemplate}"
                                        Style="{TemplateBinding EmbeddedButtonStyle}"
                                        ToolTip="Auto-Hide">
                                        <Button.Visibility>
                                            <Binding Path="IsToggleAutoHideButtonVisible" RelativeSource="{RelativeSource TemplatedParent}">
                                                <Binding.Converter>
                                                    <BooleanToVisibilityConverter />
                                                </Binding.Converter>
                                            </Binding>
                                        </Button.Visibility>
                                    </Button>
                                    <Button
                                        x:Name="minimizeButton"
                                        VerticalAlignment="Center"
                                        themes:WindowChrome.ElementKind="ClientArea"
                                        AutomationProperties.Name="Minimize"
                                        Command="{Binding MinimizeCommand, RelativeSource={RelativeSource TemplatedParent}}"
                                        ContentTemplate="{TemplateBinding MinimizeButtonContentTemplate}"
                                        Style="{TemplateBinding EmbeddedButtonStyle}"
                                        ToolTip="Minimize">
                                        <Button.Visibility>
                                            <Binding Path="IsMinimizeButtonVisible" RelativeSource="{RelativeSource TemplatedParent}">
                                                <Binding.Converter>
                                                    <BooleanToVisibilityConverter />
                                                </Binding.Converter>
                                            </Binding>
                                        </Button.Visibility>
                                    </Button>
                                    <Button
                                        x:Name="restoreButton"
                                        VerticalAlignment="Center"
                                        themes:WindowChrome.ElementKind="ClientArea"
                                        AutomationProperties.Name="Restore"
                                        Command="{Binding RestoreCommand, RelativeSource={RelativeSource TemplatedParent}}"
                                        ContentTemplate="{TemplateBinding RestoreButtonContentTemplate}"
                                        Style="{TemplateBinding EmbeddedButtonStyle}"
                                        ToolTip="Restore">
                                        <Button.Visibility>
                                            <Binding Path="IsRestoreButtonVisible" RelativeSource="{RelativeSource TemplatedParent}">
                                                <Binding.Converter>
                                                    <BooleanToVisibilityConverter />
                                                </Binding.Converter>
                                            </Binding>
                                        </Button.Visibility>
                                    </Button>
                                    <Button
                                        x:Name="maximizeButton"
                                        VerticalAlignment="Center"
                                        themes:WindowChrome.ElementKind="ClientArea"
                                        AutomationProperties.Name="Maximize"
                                        Command="{Binding MaximizeCommand, RelativeSource={RelativeSource TemplatedParent}}"
                                        ContentTemplate="{TemplateBinding MaximizeButtonContentTemplate}"
                                        Style="{TemplateBinding EmbeddedButtonStyle}"
                                        ToolTip="Maximize">
                                        <Button.Visibility>
                                            <Binding Path="IsMaximizeButtonVisible" RelativeSource="{RelativeSource TemplatedParent}">
                                                <Binding.Converter>
                                                    <BooleanToVisibilityConverter />
                                                </Binding.Converter>
                                            </Binding>
                                        </Button.Visibility>
                                    </Button>
                                    <Button
                                        x:Name="closeButton"
                                        VerticalAlignment="Center"
                                        themes:WindowChrome.ElementKind="ClientArea"
                                        AutomationProperties.Name="Close"
                                        Command="{Binding CloseCommand, RelativeSource={RelativeSource TemplatedParent}}"
                                        ContentTemplate="{TemplateBinding CloseButtonContentTemplate}"
                                        Style="{TemplateBinding EmbeddedButtonStyle}"
                                        ToolTip="Close">
                                        <Button.Visibility>
                                            <Binding Path="IsCloseButtonVisible" RelativeSource="{RelativeSource TemplatedParent}">
                                                <Binding.Converter>
                                                    <BooleanToVisibilityConverter />
                                                </Binding.Converter>
                                            </Binding>
                                        </Button.Visibility>
                                    </Button>
                                </docking:TitleBarPanel>
                            </Grid>
                        </Border>
                        <docking:ToolWindowContainerTabControl
                            x:Name="PART_TabControl"
                            Grid.Row="1"
                            themes:WindowChrome.ElementKind="ClientArea"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            CanTabsCloseOnMiddleClick="{TemplateBinding CanTabsCloseOnMiddleClick}"
                            CanTabsDrag="{Binding SelectedWindow.CanDragTabResolved, RelativeSource={RelativeSource TemplatedParent}}"
                            HasTabImages="{TemplateBinding HasTabImages}"
                            IsActive="{Binding IsActive, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}"
                            IsLayoutAnimationEnabled="{TemplateBinding IsTabLayoutAnimationEnabledResolved}"
                            IsTabKeyboardSwitchingEnabled="False"
                            IsTabStripVisible="{TemplateBinding IsTabStripVisible}"
                            ItemContainerStyle="{TemplateBinding TabItemContainerStyle}"
                            MaxTabExtent="{TemplateBinding MaxTabExtent}"
                            MinTabExtent="{TemplateBinding MinTabExtent}"
                            Style="{TemplateBinding TabControlStyle}"
                            TabOverflowBehavior="{TemplateBinding TabOverflowBehavior}"
                            UseDefaultFocusHandling="False">
                            <docking:ToolWindowContainerTabControl.TabStripPlacement>
                                <Binding Path="TabStripPlacement" RelativeSource="{RelativeSource TemplatedParent}">
                                    <Binding.Converter>
                                        <docking:SideToDockConverter />
                                    </Binding.Converter>
                                </Binding>
                            </docking:ToolWindowContainerTabControl.TabStripPlacement>
                        </docking:ToolWindowContainerTabControl>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="TabStripPlacement" Value="Top">
                            <Setter TargetName="titleBarBorder" Property="Margin" Value="0,0,0,-1" />
                        </Trigger>
                        <Trigger Property="TabStripPlacement" Value="Bottom">
                            <Setter TargetName="titleBarBorder" Property="BorderThickness">
                                <Setter.Value>
                                    <Binding
                                        ConverterParameter="Left,Top,Right"
                                        Path="BorderThickness"
                                        RelativeSource="{RelativeSource TemplatedParent}">
                                        <Binding.Converter>
                                            <shared:ThicknessConverter AllowNegative="True" Multiplier="1" />
                                        </Binding.Converter>
                                    </Binding>
                                </Setter.Value>
                            </Setter>
                            <Setter TargetName="PART_TabControl" Property="BorderThickness">
                                <Setter.Value>
                                    <Binding
                                        ConverterParameter="Left,Top,Right"
                                        Path="BorderThickness"
                                        RelativeSource="{RelativeSource TemplatedParent}">
                                        <Binding.Converter>
                                            <shared:ThicknessConverter AllowNegative="True" Multiplier="1" />
                                        </Binding.Converter>
                                    </Binding>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger SourceName="titleBarBorder" Property="Visibility" Value="Collapsed">
                            <Setter TargetName="PART_TabControl" Property="BorderThickness" Value="{Binding BorderThickness, RelativeSource={RelativeSource TemplatedParent}}" />
                        </Trigger>
                        <Trigger Property="State" Value="AutoHide">
                            <Setter TargetName="toggleAutoHideButton" Property="ContentTemplate" Value="{Binding PinButtonContentTemplate, RelativeSource={RelativeSource TemplatedParent}}" />
                        </Trigger>
                        <Trigger Property="IsActive" Value="True">
                            <Setter TargetName="titleBarBorder" Property="Background" Value="{DynamicResource {ComponentResourceKey ResourceId=DockingWindowContainerTitleBarBackgroundActiveBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                            <Setter TargetName="titleBarBorder" Property="TextElement.Foreground" Value="{DynamicResource {ComponentResourceKey ResourceId=DockingWindowContainerTitleBarGlyphBackgroundActiveBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                            <Setter TargetName="title" Property="Foreground" Value="{DynamicResource {ComponentResourceKey ResourceId=DockingWindowContainerTitleBarForegroundActiveBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}" />
                            <Setter TargetName="titleBarGripper" Property="Fill">
                                <Setter.Value>
                                    <DrawingBrush
                                        TileMode="Tile"
                                        Viewbox="0,0,4,5"
                                        ViewboxUnits="Absolute"
                                        Viewport="0,0,4,5"
                                        ViewportUnits="Absolute">
                                        <DrawingBrush.Drawing>
                                            <GeometryDrawing Brush="{DynamicResource {ComponentResourceKey ResourceId=DockingWindowContainerTitleBarForegroundActiveBrushKey, TypeInTargetAssembly={x:Type themes:AssetResourceKeys}}}">
                                                <GeometryDrawing.Geometry>
                                                    <GeometryGroup>
                                                        <RectangleGeometry Rect="0,0,1,1" />
                                                        <RectangleGeometry Rect="2,2,1,1" />
                                                        <RectangleGeometry Rect="0,4,1,1" />
                                                    </GeometryGroup>
                                                </GeometryDrawing.Geometry>
                                            </GeometryDrawing>
                                        </DrawingBrush.Drawing>
                                    </DrawingBrush>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>

[Modified 6 years ago]

Jason Stevenson

Comments (2)

Answer - Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

Whatever you used to create the style seems to not have copied everything properly.  I see that these lines are missing from ToolWindowContainerTabControl:

ItemsSource="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Windows}" 
SelectedItem="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedWindow, Mode=TwoWay}"
							

If you are a licensed WPF Studio customer, you'll be able to download our default styles/templates from your account.  I'd recommend using those in the future to avoid issues like this.


Actipro Software Support

Posted 6 years ago by Jason Stevenson - Senior Software Architect, Gemvision
Avatar

You're the man that fixed it!

For reference, to create this you simply need to right-click on the container UI in the Visual Studio Enterprise 2017 (v15.7.5)  Designer, chose Edit Template then Edit a Copy... to create the broken style.

Jason Stevenson

The latest build of this product (v24.1.2) was released 0 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.