Tool Window Header - Control Template Tweak

Docking/MDI for WPF Forum

Posted 13 years ago by Mark
Version: 11.1.0544
Avatar
Hello,

I want to show custom information in the ToolWindow header. I altered the ControlTemplate for the ToolWindowContainer which is the only way I could get it to show. Specifically, I replaced the title and context image area with a ContentPresenter that shows the ToolWindow.Header. Now it shows, but the close, auto-hide and options buttons don't work unless you double click the header and make it a floating window. But then if you dock it again, you lose the button functionality again.

Here is the Style that I got from Blend and altered. I also have an example project I can send if that helps.

Is this possible to do?

Thank you,
-Mark

                <Style TargetType="{x:Type docking:ToolWindowContainer}">
                    <Setter Property="TabBarSpacerBackground" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolWindowContainerTabBarSpacerBackground, TypeInTargetAssembly={x:Type docking:DockSite}}}"/>
                    <Setter Property="TabBarSpacerBorderBrush" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolWindowContainerTabBarSpacerBorder, TypeInTargetAssembly={x:Type docking:DockSite}}}"/>
                    <Setter Property="ItemsPanel">
                        <Setter.Value>
                            <ItemsPanelTemplate>
                                <Primitives:DockingWindowTabPanel ClipToBounds="True" CanHorizontallyScroll="False" CanVerticallyScroll="False" HorizontalTabSpacing="-1" HorizontalAlignment="Left" IsItemsHost="True" SelectedTab="{Binding SelectedItem, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type docking:ToolWindowContainer}}}"/>
                            </ItemsPanelTemplate>
                        </Setter.Value>
                    </Setter>
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="{x:Type docking:ToolWindowContainer}">
                                <Grid x:Name="rootGrid">
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition/>
                                        <RowDefinition Height="Auto"/>
                                    </Grid.RowDefinitions>
                                    <shared:PixelSnapper>
                                        <Border x:Name="titleBarBorder" BorderBrush="{TemplateBinding TitleBarBorderInactiveBrush}" BorderThickness="{TemplateBinding TitleBarBorderThickness}" Background="{TemplateBinding TitleBarBackgroundInactive}" CornerRadius="{TemplateBinding TitleBarBorderCornerRadius}" SnapsToDevicePixels="True">
                                            <Border.Visibility>
                                                <Binding Path="SelectedItem.HasTitleBarResolved" RelativeSource="{RelativeSource TemplatedParent}">
                                                    <Binding.Converter>
                                                        <BooleanToVisibilityConverter/>
                                                    </Binding.Converter>
                                                </Binding>
                                            </Border.Visibility>
                                            <DockPanel x:Name="PART_TitleBar" Background="Transparent" LastChildFill="True" Margin="{TemplateBinding Padding}">
                                                <Primitives:TitleBarButton x:Name="closeButton" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" DockPanel.Dock="Right" AutomationProperties.Name="Close" ToolTip="Close">
                                                    <Primitives:TitleBarButton.Command>
                                                        <RoutedUICommand Text="Close"/>
                                                    </Primitives:TitleBarButton.Command>
                                                    <Primitives:TitleBarButton.Visibility>
                                                        <Binding Path="SelectedItem.CanCloseResolved" RelativeSource="{RelativeSource TemplatedParent}">
                                                            <Binding.Converter>
                                                                <BooleanToVisibilityConverter/>
                                                            </Binding.Converter>
                                                        </Binding>
                                                    </Primitives:TitleBarButton.Visibility>
                                                    <Canvas Height="12" Width="12">
                                                        <Path Data="M0,0L1,0 4,3 7,0 8,0 8,1 5,4 8,7 8,8 7,8 4,5 1,8 0,8 0,7 3,4 0,1z" Fill="{Binding Foreground, ElementName=closeButton}" Height="8" Canvas.Left="2" Stretch="Fill" Canvas.Top="2" Width="8"/>
                                                    </Canvas>
                                                </Primitives:TitleBarButton>
                                                <Primitives:TitleBarButton x:Name="autoHideButton" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" DockPanel.Dock="Right" AutomationProperties.Name="Auto-Hide" ToolTip="Auto Hide">
                                                    <Primitives:TitleBarButton.Command>
                                                        <RoutedUICommand Text="Auto Hide"/>
                                                    </Primitives:TitleBarButton.Command>
                                                    <Primitives:TitleBarButton.Visibility>
                                                        <Binding Path="SelectedItem.CanAutoHideResolved" RelativeSource="{RelativeSource TemplatedParent}">
                                                            <Binding.Converter>
                                                                <BooleanToVisibilityConverter/>
                                                            </Binding.Converter>
                                                        </Binding>
                                                    </Primitives:TitleBarButton.Visibility>
                                                    <Grid>
                                                        <Canvas x:Name="pinnedGlyph" Height="12" Width="12">
                                                            <Path Data="F1M2,7L3,7 3,1 8,1 8,7 6,7 6,2 4,2 4,7 9,7 9,8 6,8 6,11 5,11 5,8 2,8" Fill="{Binding Foreground, ElementName=closeButton}" Height="10" Canvas.Left="2" Stretch="Fill" Canvas.Top="1" Width="7"/>
                                                        </Canvas>
                                                        <Canvas x:Name="unpinnedGlyph" Height="12" Visibility="Collapsed" Width="12">
                                                            <Path Data="F1M5,3L5,4 11,4 11,9 5,9 5,7 10,7 10,5 5,5 5,7 5,10 4,10 4,7 1,7 1,6 4,6 4,3" Fill="{Binding Foreground, ElementName=closeButton}" Height="7" Canvas.Left="1" Stretch="Fill" Canvas.Top="3" Width="10"/>
                                                        </Canvas>
                                                    </Grid>
                                                </Primitives:TitleBarButton>
                                                <Primitives:TitleBarButton x:Name="maximizeButton" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" DockPanel.Dock="Right" AutomationProperties.Name="Maximize" ToolTip="Maximize" Visibility="Collapsed">
                                                    <Primitives:TitleBarButton.Command>
                                                        <RoutedUICommand Text="Maximize"/>
                                                    </Primitives:TitleBarButton.Command>
                                                    <Canvas Height="12" Width="12">
                                                        <Path Data="M0,0L8,0 8,3 0,3z" Fill="{Binding Foreground, ElementName=closeButton}" Canvas.Left="2" Canvas.Top="1"/>
                                                        <Path Data="M0.5,0L0.5,5.5 7.5,5.5 7.5,0" Canvas.Left="2" Stroke="{Binding Foreground, ElementName=closeButton}" StrokeThickness="1" Canvas.Top="4"/>
                                                    </Canvas>
                                                </Primitives:TitleBarButton>
                                                <Primitives:TitleBarButton x:Name="restoreButton" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" DockPanel.Dock="Right" AutomationProperties.Name="Restore" ToolTip="Restore" Visibility="Collapsed">
                                                    <Primitives:TitleBarButton.Command>
                                                        <RoutedUICommand Text="Restore"/>
                                                    </Primitives:TitleBarButton.Command>
                                                    <Canvas Height="12" Width="12">
                                                        <Path Data="M0,3L6,3 6,5 0,5z M2,0L8,0 8,2 2,2z" Fill="{Binding Foreground, ElementName=closeButton}" Canvas.Left="2" Canvas.Top="1"/>
                                                        <Path Data="M0.5,5L0.5,8.5 5.5,8.5 5.5,5 M7.5,2L7.5,5.5 6,5.5 M2.5,4L2.5,2" Canvas.Left="2" Stroke="{Binding Foreground, ElementName=closeButton}" StrokeThickness="1" Canvas.Top="1"/>
                                                    </Canvas>
                                                </Primitives:TitleBarButton>
                                                <Primitives:TitleBarButton x:Name="optionsButton" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" DisplayMode="PopupOnly" DockPanel.Dock="Right" AutomationProperties.Name="Options" ToolTip="Options">
                                                    <Primitives:TitleBarButton.CommandParameter>
                                                        <docking:DockingContextMenuType>DockingWindowOptionsButton</docking:DockingContextMenuType>
                                                    </Primitives:TitleBarButton.CommandParameter>
                                                    <Primitives:TitleBarButton.Command>
                                                        <RoutedUICommand Text="Options"/>
                                                    </Primitives:TitleBarButton.Command>
                                                    <Primitives:TitleBarButton.Visibility>
                                                        <Binding Path="SelectedItem.HasOptionsResolved" RelativeSource="{RelativeSource TemplatedParent}">
                                                            <Binding.Converter>
                                                                <BooleanToVisibilityConverter/>
                                                            </Binding.Converter>
                                                        </Binding>
                                                    </Primitives:TitleBarButton.Visibility>
                                                    <Canvas Height="12" Width="12">
                                                        <Path Data="F1M2,6.01038L10,6 6.39404,9.55326 6.3947,10 5.6036,10 5.60293,9.55326 2,6.01038z" Fill="{Binding Foreground, ElementName=closeButton}" Height="4" Canvas.Left="2" Stretch="Fill" Canvas.Top="6" Width="8"/>
                                                    </Canvas>
                                                </Primitives:TitleBarButton>
                                                <Primitives:ReverseMeasureDockPanel>
                                                    <!--Here is where I altered the template to show the header-->
                                                    <ContentPresenter Content="{Binding SelectedItem.Header, RelativeSource={RelativeSource TemplatedParent}}" DockPanel.Dock="Left"/>
                                                    <!--<shared:PixelSnapper DockPanel.Dock="Left" VerticalAlignment="Center">
                                                        <TextBlock x:Name="title" Foreground="{TemplateBinding TitleBarForegroundInactive}" Margin="3,1,2,1" AutomationProperties.Name="Title" Text="{Binding SelectedItem.Title, RelativeSource={RelativeSource TemplatedParent}}" TextTrimming="CharacterEllipsis"/>
                                                    </shared:PixelSnapper>
                                                    <Image x:Name="contextImage" DockPanel.Dock="Left" Margin="0,1,2,1" AutomationProperties.Name="Context Image" Source="{Binding SelectedItem.ContextImageSource, RelativeSource={RelativeSource TemplatedParent}}" Stretch="None" SnapsToDevicePixels="True" VerticalAlignment="Center"/>-->
                                                </Primitives:ReverseMeasureDockPanel>
                                            </DockPanel>
                                        </Border>
                                    </shared:PixelSnapper>
                                    <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Grid.Row="2" SnapsToDevicePixels="True">
                                        <Border BorderBrush="{Binding SelectedItem.BorderBrush, RelativeSource={RelativeSource TemplatedParent}}" BorderThickness="{Binding SelectedItem.BorderThickness, RelativeSource={RelativeSource TemplatedParent}}" Background="{Binding SelectedItem.Background, RelativeSource={RelativeSource TemplatedParent}}" SnapsToDevicePixels="True">
                                            <Animation:TransitionPresenter x:Name="PART_SelectedContentHost" ContentTemplate="{TemplateBinding SelectedContentTemplate}" Content="{TemplateBinding SelectedContent}" DefaultDuration="0:0:0.15" TransitionSelector="{TemplateBinding docking:DockSite.ToolWindowTransitionSelector}"/>
                                        </Border>
                                    </Border>
                                    <Border x:Name="tabPanelBorder" BorderBrush="{TemplateBinding TabBarSpacerBorderBrush}" BorderThickness="0,0,0,1" Background="{TemplateBinding TabBarSpacerBackground}" Height="3" Grid.Row="3" SnapsToDevicePixels="True" VerticalAlignment="Top">
                                        <Border.Visibility>
                                            <Binding Path="IsTabBarVisible" RelativeSource="{RelativeSource TemplatedParent}">
                                                <Binding.Converter>
                                                    <BooleanToVisibilityConverter/>
                                                </Binding.Converter>
                                            </Binding>
                                        </Border.Visibility>
                                    </Border>
                                    <Grid x:Name="tabPanelGrid" Margin="0,2,0,1" Grid.Row="3">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="*"/>
                                            <ColumnDefinition Width="Auto"/>
                                        </Grid.ColumnDefinitions>
                                        <Grid.Visibility>
                                            <Binding Path="IsTabBarVisible" RelativeSource="{RelativeSource TemplatedParent}">
                                                <Binding.Converter>
                                                    <BooleanToVisibilityConverter/>
                                                </Binding.Converter>
                                            </Binding>
                                        </Grid.Visibility>
                                        <ScrollViewer x:Name="scrollViewer" CanContentScroll="True" HorizontalScrollBarVisibility="Disabled" Primitives:DockingWindowTabPanel.IsStretched="True" Style="{DynamicResource {ComponentResourceKey ResourceId=DockingTabScrollViewerStyleKey, TypeInTargetAssembly={x:Type docking:DockSite}}}" Primitives:DockingWindowTabPanel.StretchDirection="DownOnly" VerticalScrollBarVisibility="Disabled">
                                            <ItemsPresenter/>
                                        </ScrollViewer>
                                        <Primitives:TitleBarButton x:Name="toolsButton" Grid.Column="1" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" CommandParameter="{Binding RelativeSource={RelativeSource Self}}" DisplayMode="PopupOnly" Margin="1,2" AutomationProperties.Name="Tool Windows" ToolTip="Active Tool Windows" Visibility="Collapsed">
                                            <Primitives:TitleBarButton.Command>
                                                <RoutedUICommand Text="Active Tool Windows"/>
                                            </Primitives:TitleBarButton.Command>
                                            <Primitives:TitleBarButton.Style>
                                                <Style TargetType="{x:Type Primitives:TitleBarButton}">
                                                    <Setter Property="ForegroundActiveDisabled" Value="{DynamicResource {ComponentResourceKey ResourceId=TabbedMdiContainerButtonForegroundNormal, TypeInTargetAssembly={x:Type docking:DockSite}}}"/>
                                                    <Setter Property="BackgroundActiveHover" Value="{DynamicResource {ComponentResourceKey ResourceId=TabbedMdiContainerButtonBackgroundHover, TypeInTargetAssembly={x:Type docking:DockSite}}}"/>
                                                    <Setter Property="BorderActiveHoverBrush" Value="{DynamicResource {ComponentResourceKey ResourceId=TabbedMdiContainerButtonBorderHover, TypeInTargetAssembly={x:Type docking:DockSite}}}"/>
                                                    <Setter Property="ForegroundActiveHover" Value="{DynamicResource {ComponentResourceKey ResourceId=TabbedMdiContainerButtonForegroundHover, TypeInTargetAssembly={x:Type docking:DockSite}}}"/>
                                                    <Setter Property="ForegroundActiveNormal" Value="{DynamicResource {ComponentResourceKey ResourceId=TabbedMdiContainerButtonForegroundNormal, TypeInTargetAssembly={x:Type docking:DockSite}}}"/>
                                                    <Setter Property="BackgroundActivePressed" Value="{DynamicResource {ComponentResourceKey ResourceId=TabbedMdiContainerButtonBackgroundHover, TypeInTargetAssembly={x:Type docking:DockSite}}}"/>
                                                    <Setter Property="BorderActivePressedBrush" Value="{DynamicResource {ComponentResourceKey ResourceId=TabbedMdiContainerButtonBorderHover, TypeInTargetAssembly={x:Type docking:DockSite}}}"/>
                                                    <Setter Property="ForegroundActivePressed" Value="{DynamicResource {ComponentResourceKey ResourceId=TabbedMdiContainerButtonForegroundHover, TypeInTargetAssembly={x:Type docking:DockSite}}}"/>
                                                    <Setter Property="ForegroundInactiveDisabled" Value="{DynamicResource {ComponentResourceKey ResourceId=TabbedMdiContainerButtonForegroundNormal, TypeInTargetAssembly={x:Type docking:DockSite}}}"/>
                                                    <Setter Property="BackgroundInactiveHover" Value="{DynamicResource {ComponentResourceKey ResourceId=TabbedMdiContainerButtonBackgroundHover, TypeInTargetAssembly={x:Type docking:DockSite}}}"/>
                                                    <Setter Property="BorderInactiveHoverBrush" Value="{DynamicResource {ComponentResourceKey ResourceId=TabbedMdiContainerButtonBorderHover, TypeInTargetAssembly={x:Type docking:DockSite}}}"/>
                                                    <Setter Property="ForegroundInactiveHover" Value="{DynamicResource {ComponentResourceKey ResourceId=TabbedMdiContainerButtonForegroundHover, TypeInTargetAssembly={x:Type docking:DockSite}}}"/>
                                                    <Setter Property="ForegroundInactiveNormal" Value="{DynamicResource {ComponentResourceKey ResourceId=TabbedMdiContainerButtonForegroundNormal, TypeInTargetAssembly={x:Type docking:DockSite}}}"/>
                                                    <Style.BasedOn>
                                                        <Style TargetType="{x:Type Primitives:TitleBarButton}">
                                                            <Setter Property="BackgroundActiveDisabled" Value="Transparent"/>
                                                            <Setter Property="BorderActiveDisabledBrush" Value="Transparent"/>
                                                            <Setter Property="ForegroundActiveDisabled" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolWindowContainerTitleBarForegroundActive, TypeInTargetAssembly={x:Type docking:DockSite}}}"/>
                                                            <Setter Property="BackgroundActiveHover" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolWindowContainerTitleBarButtonBackgroundActiveHover, TypeInTargetAssembly={x:Type docking:DockSite}}}"/>
                                                            <Setter Property="BackgroundActiveHoverHighlight" Value="Transparent"/>
                                                            <Setter Property="BorderActiveHoverBrush" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolWindowContainerTitleBarButtonBorderActiveHover, TypeInTargetAssembly={x:Type docking:DockSite}}}"/>
                                                            <Setter Property="ForegroundActiveHover" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolWindowContainerTitleBarForegroundActive, TypeInTargetAssembly={x:Type docking:DockSite}}}"/>
                                                            <Setter Property="BackgroundActiveNormal" Value="Transparent"/>
                                                            <Setter Property="BorderActiveNormalBrush" Value="Transparent"/>
                                                            <Setter Property="ForegroundActiveNormal" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolWindowContainerTitleBarForegroundActive, TypeInTargetAssembly={x:Type docking:DockSite}}}"/>
                                                            <Setter Property="BackgroundActivePressed" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolWindowContainerTitleBarButtonBackgroundActivePressed, TypeInTargetAssembly={x:Type docking:DockSite}}}"/>
                                                            <Setter Property="BackgroundActivePressedHighlight" Value="Transparent"/>
                                                            <Setter Property="BorderActivePressedBrush" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolWindowContainerTitleBarButtonBorderActivePressed, TypeInTargetAssembly={x:Type docking:DockSite}}}"/>
                                                            <Setter Property="ForegroundActivePressed" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolWindowContainerTitleBarForegroundActive, TypeInTargetAssembly={x:Type docking:DockSite}}}"/>
                                                            <Setter Property="Background" Value="{Binding BackgroundInactiveNormal, RelativeSource={RelativeSource Self}}"/>
                                                            <Setter Property="BorderBrush" Value="{Binding BorderInactiveNormalBrush, RelativeSource={RelativeSource Self}}"/>
                                                            <Setter Property="BorderThickness" Value="1"/>
                                                            <Setter Property="Foreground" Value="{Binding ForegroundInactiveNormal, RelativeSource={RelativeSource Self}}"/>
                                                            <Setter Property="BackgroundInactiveDisabled" Value="Transparent"/>
                                                            <Setter Property="BorderInactiveDisabledBrush" Value="Transparent"/>
                                                            <Setter Property="ForegroundInactiveDisabled" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolWindowContainerTitleBarForegroundInactive, TypeInTargetAssembly={x:Type docking:DockSite}}}"/>
                                                            <Setter Property="BackgroundInactiveHover" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolWindowContainerTitleBarButtonBackgroundInactiveHover, TypeInTargetAssembly={x:Type docking:DockSite}}}"/>
                                                            <Setter Property="BackgroundInactiveHoverHighlight" Value="Transparent"/>
                                                            <Setter Property="BorderInactiveHoverBrush" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolWindowContainerTitleBarButtonBorderInactiveHover, TypeInTargetAssembly={x:Type docking:DockSite}}}"/>
                                                            <Setter Property="ForegroundInactiveHover" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolWindowContainerTitleBarForegroundInactive, TypeInTargetAssembly={x:Type docking:DockSite}}}"/>
                                                            <Setter Property="BackgroundInactiveNormal" Value="Transparent"/>
                                                            <Setter Property="BorderInactiveNormalBrush" Value="Transparent"/>
                                                            <Setter Property="ForegroundInactiveNormal" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolWindowContainerTitleBarForegroundInactive, TypeInTargetAssembly={x:Type docking:DockSite}}}"/>
                                                            <Setter Property="Margin" Value="0,1"/>
                                                            <Setter Property="Padding" Value="1"/>
                                                            <Setter Property="VerticalAlignment" Value="Center"/>
                                                            <Setter Property="Template">
                                                                <Setter.Value>
                                                                    <ControlTemplate TargetType="{x:Type Primitives:TitleBarButton}">
                                                                        <Grid>
                                                                            <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="{TemplateBinding CornerRadius}" SnapsToDevicePixels="True">
                                                                                <Grid>
                                                                                    <Border x:Name="innerBorder" CornerRadius="{TemplateBinding CornerRadius}"/>
                                                                                    <ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Margin="{TemplateBinding Padding}"/>
                                                                                </Grid>
                                                                            </Border>
                                                                            <Rectangle x:Name="PART_IndicatorArea" Fill="Transparent" Visibility="Collapsed"/>
                                                                        </Grid>
                                                                        <ControlTemplate.Triggers>
                                                                            <Trigger Property="DisplayMode" Value="PopupOnly">
                                                                                <Setter Property="Visibility" TargetName="PART_IndicatorArea" Value="Visible"/>
                                                                            </Trigger>
                                                                            <MultiTrigger>
                                                                                <MultiTrigger.Conditions>
                                                                                    <Condition Property="IsActive" Value="False"/>
                                                                                    <Condition Property="IsEnabled" Value="False"/>
                                                                                </MultiTrigger.Conditions>
                                                                                <Setter Property="Background" Value="{Binding BackgroundInactiveDisabled, RelativeSource={RelativeSource Self}}"/>
                                                                                <Setter Property="BorderBrush" Value="{Binding BorderInactiveDisabledBrush, RelativeSource={RelativeSource Self}}"/>
                                                                                <Setter Property="Foreground" Value="{Binding ForegroundInactiveDisabled, RelativeSource={RelativeSource Self}}"/>
                                                                            </MultiTrigger>
                                                                            <MultiTrigger>
                                                                                <MultiTrigger.Conditions>
                                                                                    <Condition Property="IsActive" Value="False"/>
                                                                                    <Condition Property="IsEnabled" Value="True"/>
                                                                                    <Condition Property="IsMouseOver" Value="True"/>
                                                                                </MultiTrigger.Conditions>
                                                                                <Setter Property="Background" Value="{Binding BackgroundInactiveHover, RelativeSource={RelativeSource Self}}"/>
                                                                                <Setter Property="BorderBrush" Value="{Binding BorderInactiveHoverBrush, RelativeSource={RelativeSource Self}}"/>
                                                                                <Setter Property="Foreground" Value="{Binding ForegroundInactiveHover, RelativeSource={RelativeSource Self}}"/>
                                                                                <Setter Property="Background" TargetName="innerBorder" Value="{Binding BackgroundInactiveHoverHighlight, RelativeSource={RelativeSource TemplatedParent}}"/>
                                                                            </MultiTrigger>
                                                                            <MultiTrigger>
                                                                                <MultiTrigger.Conditions>
                                                                                    <Condition Property="IsActive" Value="True"/>
                                                                                    <Condition Property="IsEnabled" Value="False"/>
                                                                                </MultiTrigger.Conditions>
                                                                                <Setter Property="Background" Value="{Binding BackgroundActiveDisabled, RelativeSource={RelativeSource Self}}"/>
                                                                                <Setter Property="BorderBrush" Value="{Binding BorderActiveDisabledBrush, RelativeSource={RelativeSource Self}}"/>
                                                                                <Setter Property="Foreground" Value="{Binding ForegroundActiveDisabled, RelativeSource={RelativeSource Self}}"/>
                                                                            </MultiTrigger>
                                                                            <MultiTrigger>
                                                                                <MultiTrigger.Conditions>
                                                                                    <Condition Property="IsActive" Value="True"/>
                                                                                    <Condition Property="IsEnabled" Value="True"/>
                                                                                    <Condition Property="IsMouseOver" Value="False"/>
                                                                                    <Condition Property="IsPopupOpen" Value="False"/>
                                                                                    <Condition Property="IsPressed" Value="False"/>
                                                                                </MultiTrigger.Conditions>
                                                                                <Setter Property="Background" Value="{Binding BackgroundActiveNormal, RelativeSource={RelativeSource Self}}"/>
                                                                                <Setter Property="BorderBrush" Value="{Binding BorderActiveNormalBrush, RelativeSource={RelativeSource Self}}"/>
                                                                                <Setter Property="Foreground" Value="{Binding ForegroundActiveNormal, RelativeSource={RelativeSource Self}}"/>
                                                                            </MultiTrigger>
                                                                            <MultiTrigger>
                                                                                <MultiTrigger.Conditions>
                                                                                    <Condition Property="IsActive" Value="True"/>
                                                                                    <Condition Property="IsEnabled" Value="True"/>
                                                                                    <Condition Property="IsMouseOver" Value="True"/>
                                                                                    <Condition Property="IsPopupOpen" Value="False"/>
                                                                                    <Condition Property="IsPressed" Value="False"/>
                                                                                </MultiTrigger.Conditions>
                                                                                <Setter Property="Background" Value="{Binding BackgroundActiveHover, RelativeSource={RelativeSource Self}}"/>
                                                                                <Setter Property="BorderBrush" Value="{Binding BorderActiveHoverBrush, RelativeSource={RelativeSource Self}}"/>
                                                                                <Setter Property="Foreground" Value="{Binding ForegroundActiveHover, RelativeSource={RelativeSource Self}}"/>
                                                                                <Setter Property="Background" TargetName="innerBorder" Value="{Binding BackgroundActiveHoverHighlight, RelativeSource={RelativeSource TemplatedParent}}"/>
                                                                            </MultiTrigger>
                                                                            <MultiTrigger>
                                                                                <MultiTrigger.Conditions>
                                                                                    <Condition Property="IsActive" Value="True"/>
                                                                                    <Condition Property="IsEnabled" Value="True"/>
                                                                                    <Condition Property="IsPopupOpen" Value="True"/>
                                                                                </MultiTrigger.Conditions>
                                                                                <Setter Property="Background" Value="{Binding BackgroundActivePressed, RelativeSource={RelativeSource Self}}"/>
                                                                                <Setter Property="BorderBrush" Value="{Binding BorderActivePressedBrush, RelativeSource={RelativeSource Self}}"/>
                                                                                <Setter Property="Foreground" Value="{Binding ForegroundActivePressed, RelativeSource={RelativeSource Self}}"/>
                                                                            </MultiTrigger>
                                                                            <MultiTrigger>
                                                                                <MultiTrigger.Conditions>
                                                                                    <Condition Property="IsActive" Value="True"/>
                                                                                    <Condition Property="IsEnabled" Value="True"/>
                                                                                    <Condition Property="IsPressed" Value="True"/>
                                                                                </MultiTrigger.Conditions>
                                                                                <Setter Property="Background" Value="{Binding BackgroundActivePressed, RelativeSource={RelativeSource Self}}"/>
                                                                                <Setter Property="BorderBrush" Value="{Binding BorderActivePressedBrush, RelativeSource={RelativeSource Self}}"/>
                                                                                <Setter Property="Foreground" Value="{Binding ForegroundActivePressed, RelativeSource={RelativeSource Self}}"/>
                                                                            </MultiTrigger>
                                                                        </ControlTemplate.Triggers>
                                                                    </ControlTemplate>
                                                                </Setter.Value>
                                                            </Setter>
                                                        </Style>
                                                    </Style.BasedOn>
                                                </Style>
                                            </Primitives:TitleBarButton.Style>
                                            <Grid>
                                                <Canvas x:Name="listGlyph" Height="10" Width="10">
                                                    <Path Data="F1M2,6.01038L10,6 6.39404,9.55326 6.3947,10 5.6036,10 5.60293,9.55326 2,6.01038z" Fill="{Binding Foreground, ElementName=toolsButton}" Height="4" Canvas.Left="1" Stretch="Fill" Canvas.Top="5" Width="8"/>
                                                </Canvas>
                                                <Canvas x:Name="listAdvGlyph" Height="10" Visibility="Collapsed" Width="10">
                                                    <Path Data="F1M2,6.01038L10,6 6.39404,9.55326 6.3947,10 5.6036,10 5.60293,9.55326 2,6.01038z" Fill="{Binding Foreground, ElementName=toolsButton}" Height="4" Canvas.Left="1" Stretch="Fill" Canvas.Top="5" Width="8"/>
                                                    <Path Data="F1M3,2L9,2C9.55228,2,10,2.44771,10,3L10,3C10,3.55229,9.55228,4,9,4L3,4C2.44771,4,2,3.55229,2,3L2,3C2,2.44771,2.44771,2,3,2z" Fill="{Binding Foreground, ElementName=toolsButton}" Height="2" Canvas.Left="1" Stretch="Fill" Canvas.Top="1" Width="8"/>
                                                </Canvas>
                                            </Grid>
                                        </Primitives:TitleBarButton>
                                    </Grid>
                                    <Border x:Name="sideBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1,0" HorizontalAlignment="Stretch" Grid.Row="1" SnapsToDevicePixels="True" Visibility="Collapsed" VerticalAlignment="Stretch"/>
                                </Grid>
                                <ControlTemplate.Triggers>
                                    <Trigger Property="Primitives:TitleBarButton.IsActive" Value="True">
                                        <Setter Property="Background" TargetName="titleBarBorder" Value="{Binding TitleBarBackgroundActive, RelativeSource={RelativeSource TemplatedParent}}"/>
                                        <Setter Property="BorderBrush" TargetName="titleBarBorder" Value="{Binding TitleBarBorderActiveBrush, RelativeSource={RelativeSource TemplatedParent}}"/>
                                        <!--<Setter Property="Foreground" TargetName="title" Value="{Binding TitleBarForegroundActive, RelativeSource={RelativeSource TemplatedParent}}"/>-->
                                    </Trigger>
                                    <Trigger Property="AllTabsVisible" Value="False">
                                        <Setter Property="Visibility" TargetName="listGlyph" Value="Collapsed"/>
                                        <Setter Property="Visibility" TargetName="listAdvGlyph" Value="Visible"/>
                                    </Trigger>
                                    <Trigger Property="TabOverflowBehaviorResolved" Value="None">
                                        <Setter Property="Primitives:DockingWindowTabPanel.IsStretched" TargetName="scrollViewer" Value="False"/>
                                    </Trigger>
                                    <Trigger Property="TabOverflowBehaviorResolved" Value="Menu">
                                        <Setter Property="Primitives:DockingWindowTabPanel.IsStretched" TargetName="scrollViewer" Value="False"/>
                                        <Setter Property="Visibility" TargetName="toolsButton" Value="Visible"/>
                                    </Trigger>
                                    <Trigger Property="TabOverflowBehaviorResolved" Value="ShrinkWithMenu">
                                        <Setter Property="Visibility" TargetName="toolsButton" Value="Visible"/>
                                    </Trigger>
                                    <Trigger Property="TabOverflowBehaviorResolved" Value="Scroll">
                                        <Setter Property="HorizontalScrollBarVisibility" TargetName="scrollViewer" Value="Visible"/>
                                        <Setter Property="Primitives:DockingWindowTabPanel.IsStretched" TargetName="scrollViewer" Value="False"/>
                                    </Trigger>
                                    <Trigger Property="TabOverflowBehaviorResolved" Value="ScrollWithMenu">
                                        <Setter Property="HorizontalScrollBarVisibility" TargetName="scrollViewer" Value="Visible"/>
                                        <Setter Property="Primitives:DockingWindowTabPanel.IsStretched" TargetName="scrollViewer" Value="False"/>
                                        <Setter Property="Visibility" TargetName="toolsButton" Value="Visible"/>
                                    </Trigger>
                                    <MultiTrigger>
                                        <MultiTrigger.Conditions>
                                            <Condition Property="HasSingleWindow" Value="True"/>
                                            <Condition Property="SingleTabLayoutBehaviorResolved" Value="Hide"/>
                                        </MultiTrigger.Conditions>
                                        <Setter Property="Visibility" TargetName="tabPanelBorder" Value="Collapsed"/>
                                        <Setter Property="Visibility" TargetName="tabPanelGrid" Value="Collapsed"/>
                                    </MultiTrigger>
                                    <MultiTrigger>
                                        <MultiTrigger.Conditions>
                                            <Condition Property="HasSingleWindow" Value="True"/>
                                            <Condition Property="SingleTabLayoutBehaviorResolved" Value="Stretch"/>
                                        </MultiTrigger.Conditions>
                                        <Setter Property="HorizontalContentAlignment" TargetName="scrollViewer" Value="Stretch"/>
                                        <Setter Property="HorizontalScrollBarVisibility" TargetName="scrollViewer" Value="Hidden"/>
                                        <Setter Property="Primitives:DockingWindowTabPanel.IsStretched" TargetName="scrollViewer" Value="True"/>
                                        <Setter Property="Primitives:DockingWindowTabPanel.StretchDirection" TargetName="scrollViewer" Value="Both"/>
                                        <Setter Property="Visibility" TargetName="toolsButton" Value="Collapsed"/>
                                    </MultiTrigger>
                                    <Trigger Property="HasWindows" Value="False">
                                        <Setter Property="Visibility" TargetName="rootGrid" Value="Collapsed"/>
                                    </Trigger>
                                    <Trigger Property="State" Value="AutoHide">
                                        <Setter Property="Visibility" TargetName="pinnedGlyph" Value="Collapsed"/>
                                        <Setter Property="Visibility" TargetName="unpinnedGlyph" Value="Visible"/>
                                    </Trigger>
                                    <MultiDataTrigger>
                                        <MultiDataTrigger.Conditions>
                                            <Condition Binding="{Binding State, RelativeSource={RelativeSource Self}}" Value="Floating"/>
                                            <Condition Binding="{Binding SelectedItem.CanMaximizeResolved, RelativeSource={RelativeSource Self}}" Value="true"/>
                                            <Condition Binding="{Binding (Primitives:RaftableDockingWindowContainer.CanContainerMaximize), RelativeSource={RelativeSource Self}}" Value="true"/>
                                            <Condition Binding="{Binding (Primitives:RaftableDockingWindowContainer.IsMaximized), RelativeSource={RelativeSource Self}}" Value="false"/>
                                        </MultiDataTrigger.Conditions>
                                        <Setter Property="Visibility" TargetName="maximizeButton" Value="Visible"/>
                                    </MultiDataTrigger>
                                    <MultiDataTrigger>
                                        <MultiDataTrigger.Conditions>
                                            <Condition Binding="{Binding State, RelativeSource={RelativeSource Self}}" Value="Floating"/>
                                            <Condition Binding="{Binding SelectedItem.CanMaximizeResolved, RelativeSource={RelativeSource Self}}" Value="true"/>
                                            <Condition Binding="{Binding (Primitives:RaftableDockingWindowContainer.CanContainerMaximize), RelativeSource={RelativeSource Self}}" Value="true"/>
                                            <Condition Binding="{Binding (Primitives:RaftableDockingWindowContainer.IsMaximized), RelativeSource={RelativeSource Self}}" Value="true"/>
                                        </MultiDataTrigger.Conditions>
                                        <Setter Property="Visibility" TargetName="restoreButton" Value="Visible"/>
                                    </MultiDataTrigger>
                                    <!--<Trigger Property="Source" SourceName="contextImage" Value="{x:Null}">
                                        <Setter Property="Visibility" TargetName="contextImage" Value="Collapsed"/>
                                    </Trigger>-->
                                    <Trigger Property="docking:DockSite.ToolWindowsTabPlacement" Value="Top">
                                        <Setter Property="BorderThickness" Value="1"/>
                                        <Setter Property="Grid.Row" TargetName="tabPanelBorder" Value="1"/>
                                        <Setter Property="BorderThickness" TargetName="tabPanelBorder" Value="0,1,0,0"/>
                                        <Setter Property="VerticalAlignment" TargetName="tabPanelBorder" Value="Bottom"/>
                                        <Setter Property="Grid.Row" TargetName="tabPanelGrid" Value="1"/>
                                        <Setter Property="Margin" TargetName="tabPanelGrid" Value="0,1,0,2"/>
                                    </Trigger>
                                    <MultiTrigger>
                                        <MultiTrigger.Conditions>
                                            <Condition Property="docking:DockSite.ToolWindowsTabPlacement" Value="Top"/>
                                            <Condition Property="IsTabBarVisible" Value="True"/>
                                            <Condition Property="Visibility" SourceName="titleBarBorder" Value="Visible"/>
                                        </MultiTrigger.Conditions>
                                        <Setter Property="Visibility" TargetName="sideBorder" Value="Visible"/>
                                    </MultiTrigger>
                                </ControlTemplate.Triggers>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                    <Style.BasedOn>
                        <Style TargetType="{x:Type Primitives:RaftableDockingWindowContainer}">
                            <Setter Property="Background" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolWindowContainerBackground, TypeInTargetAssembly={x:Type docking:DockSite}}}"/>
                            <Setter Property="BorderBrush" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolWindowContainerBorder, TypeInTargetAssembly={x:Type docking:DockSite}}}"/>
                            <Setter Property="BorderThickness" Value="1,0,1,1"/>
                            <Setter Property="SnapsToDevicePixels" Value="True"/>
                            <Setter Property="TitleBarBackgroundActive" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolWindowContainerTitleBarBackgroundActive, TypeInTargetAssembly={x:Type docking:DockSite}}}"/>
                            <Setter Property="TitleBarBackgroundInactive" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolWindowContainerTitleBarBackgroundInactive, TypeInTargetAssembly={x:Type docking:DockSite}}}"/>
                            <Setter Property="TitleBarBorderActiveBrush" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolWindowContainerTitleBarBorderActive, TypeInTargetAssembly={x:Type docking:DockSite}}}"/>
                            <Setter Property="TitleBarBorderInactiveBrush" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolWindowContainerTitleBarBorderInactive, TypeInTargetAssembly={x:Type docking:DockSite}}}"/>
                            <Setter Property="TitleBarForegroundActive" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolWindowContainerTitleBarForegroundActive, TypeInTargetAssembly={x:Type docking:DockSite}}}"/>
                            <Setter Property="TitleBarForegroundInactive" Value="{DynamicResource {ComponentResourceKey ResourceId=ToolWindowContainerTitleBarForegroundInactive, TypeInTargetAssembly={x:Type docking:DockSite}}}"/>
                            <Setter Property="TitleBarBorderThickness" Value="1,1,1,0"/>
                            <Style.Triggers>
                                <MultiDataTrigger>
                                    <MultiDataTrigger.Conditions>
                                        <Condition Binding="{Binding SelectedItem.HasTitleBarResolved, RelativeSource={RelativeSource Self}}" Value="False"/>
                                    </MultiDataTrigger.Conditions>
                                    <Setter Property="BorderThickness" Value="1"/>
                                </MultiDataTrigger>
                            </Style.Triggers>
                        </Style>
                    </Style.BasedOn>
                </Style>

Comments (2)

Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Mark,

Unfortunately, Blend does not always extract styles correctly. In this case, the RoutedCommand definitions are incorrect. For example, the command for the close button should be Command="{x:Static docking:DockingCommands.CloseWindow}", but as you can see the Blend version is not the same.

Your best bet would be to take the default styles and then tweak those as there may be other minor issues with the version created by Blend. If you purchased WPF Studio, you can download the default Styles from our website under My Account > Organization Purchases. If you purchased WPF Essentials or individual products, then you can email our support address to request the default Styles for your licensed products.


Actipro Software Support

Posted 13 years ago by Mark
Avatar
Thanks! I have the docking library only, so I will email support to get the default styles.

Cheers,
-Mark
The latest build of this product (v24.1.3) was released 3 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.