Q: How to modify Style of DocumentWindow?

Docking/MDI for WPF Forum

Posted 14 years ago by SeongTae Jeong
Version: 9.1.0505
Avatar
Using Blend, I could apply new style as follows,
<Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    
    xmlns:local="clr-namespace:WpfApplication13"
    xmlns:docking="http://schemas.actiprosoftware.com/winfx/xaml/docking" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" xmlns:shared="http://schemas.actiprosoftware.com/winfx/xaml/shared" x:Class="WpfApplication13.Window1"
    Title="Window1" Height="600" Width="600" docking:TabbedMdiHost.IsCloseButtonOnTab="True">
    <Window.Resources>
        <Style x:Key="DocumentWindowStyle1" TargetType="{x:Type docking:DocumentWindow}">
            <Style.BasedOn>
                <Style TargetType="{x:Type docking:DockingWindow}">
                    <Setter Property="Foreground" Value="{DynamicResource {ComponentResourceKey ResourceId=DocumentTabForegroundNormal, TypeInTargetAssembly={x:Type docking:DockSite}}}"/>
                    <Setter Property="Background" Value="{DynamicResource {ComponentResourceKey ResourceId=DocumentTabBackgroundNormal, TypeInTargetAssembly={x:Type docking:DockSite}}}"/>
                    <Setter Property="BorderBrush" Value="{DynamicResource {ComponentResourceKey ResourceId=DocumentTabBorderNormal, TypeInTargetAssembly={x:Type docking:DockSite}}}"/>
                    <Setter Property="Padding" Value="2,0,4,0"/>
                    <Setter Property="Margin" Value="0,2,-10,0"/>
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="{x:Type docking:DockingWindow}">
                                <ControlTemplate.Resources>
                                    <docking:TitleConverter x:Key="DocumentTitleConverter" Patch="..." Prefix="20" Suffix="15"/>
                                </ControlTemplate.Resources>
                                <shared:PixelSnapper>
                                    <docking:DocumentTabDecorator ToolTip="{TemplateBinding ToolTip}" BackgroundHover="{DynamicResource {ComponentResourceKey ResourceId=DocumentTabBackgroundHover, TypeInTargetAssembly={x:Type docking:DockSite}}}" BackgroundNormal="{TemplateBinding Background}" BackgroundSelected="{DynamicResource {ComponentResourceKey ResourceId=DocumentTabBackgroundSelected, TypeInTargetAssembly={x:Type docking:DockSite}}}" BorderBrushHover="{DynamicResource {ComponentResourceKey ResourceId=DocumentTabBorderHover, TypeInTargetAssembly={x:Type docking:DockSite}}}" BorderBrushNormal="{TemplateBinding BorderBrush}" BorderBrushSelected="{DynamicResource {ComponentResourceKey ResourceId=DocumentTabBorderSelected, TypeInTargetAssembly={x:Type docking:DockSite}}}" IsSelected="{TemplateBinding IsSelected}">
                                        <StackPanel Margin="{TemplateBinding Padding}" MinHeight="14" Orientation="Horizontal">
                                            <Button>It must be!</Button>
                                            <shared:PixelSnapper HorizontalRoundMode="CeilingToEven">
                                                <Grid x:Name="tabContent">
                                                    <TextBlock x:Name="titlePlaceholder" Visibility="Hidden" FontWeight="Bold">
                                                        <TextBlock.Text>
                                                            <Binding Path="Title" RelativeSource="{RelativeSource TemplatedParent}">
                                                                <Binding.Converter>
                                                                    <docking:TitleConverter Patch="..." Prefix="20" Suffix="15"/>
                                                                </Binding.Converter>
                                                            </Binding>
                                                        </TextBlock.Text>
                                                    </TextBlock>
                                                    <shared:PixelSnapper HorizontalAlignment="Center" HorizontalRoundMode="CeilingToEven">
                                                        <StackPanel Orientation="Horizontal">
                                                            <Image x:Name="image" Margin="0,1,1,0" VerticalAlignment="Center" Width="16" Height="16" SnapsToDevicePixels="True" Visibility="Collapsed" AutomationProperties.Name="Image" Source="{TemplateBinding ImageSource}"/>
                                                            <Grid>
                                                                <TextBlock x:Name="title" VerticalAlignment="Center" AutomationProperties.Name="Title">
                                                                    <TextBlock.Text>
                                                                        <Binding Path="Title" RelativeSource="{RelativeSource TemplatedParent}">
                                                                            <Binding.Converter>
                                                                                <docking:TitleConverter Patch="..." Prefix="20" Suffix="15"/>
                                                                            </Binding.Converter>
                                                                        </Binding>
                                                                    </TextBlock.Text>
                                                                </TextBlock>
                                                                <TextBox x:Name="PART_TitleTextBox" HorizontalAlignment="Stretch" MinWidth="50" VerticalAlignment="Center" Background="Transparent" BorderThickness="0" Padding="0" Visibility="Collapsed" AutomationProperties.Name="Inplace Editor" Text="{Binding Title, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}"/>
                                                            </Grid>
                                                        </StackPanel>
                                                    </shared:PixelSnapper>
                                                </Grid>
                                            </shared:PixelSnapper>
                                            <Image x:Name="contextImage" VerticalAlignment="Center" SnapsToDevicePixels="True" AutomationProperties.Name="Context Image" Source="{TemplateBinding ContextImageSource}" Stretch="None"/>
                                            <docking:TitleBarButton x:Name="closeButton" Margin="1" ToolTip="Close" Focusable="False" Visibility="Collapsed" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" ForegroundActiveDisabled="{TemplateBinding Foreground}" ForegroundActiveNormal="{TemplateBinding Foreground}" ForegroundInactiveDisabled="{TemplateBinding Foreground}" ForegroundInactiveNormal="{TemplateBinding Foreground}" AutomationProperties.Name="Close">
                                                <docking:TitleBarButton.Style>
                                                    <Style TargetType="{x:Type docking: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 docking: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 docking:TitleBarButton}">
                                                                            <Grid>
                                                                                <Border SnapsToDevicePixels="True" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="{TemplateBinding CornerRadius}">
                                                                                    <Grid>
                                                                                        <Border x:Name="innerBorder" CornerRadius="{TemplateBinding CornerRadius}"/>
                                                                                        <ContentPresenter Margin="{TemplateBinding Padding}" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}"/>
                                                                                    </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>
                                                </docking:TitleBarButton.Style>
                                                <docking:TitleBarButton.Command>
                                                    <RoutedUICommand Text="Close"/>
                                                </docking:TitleBarButton.Command>
                                                <Canvas Width="8" Height="8">
                                                    <Path Fill="{Binding Foreground, ElementName=closeButton}" Stretch="Fill" Width="6" Height="6" Canvas.Left="1" Canvas.Top="1" Data="M0,0L1,0 3,2 5,0 6,0 6,1 4,3 6,5 6,6 5,6 3,4 1,6 0,6 0,5 2,3 0,1z"/>
                                                </Canvas>
                                            </docking:TitleBarButton>
                                        </StackPanel>
                                    </docking:DocumentTabDecorator>
                                </shared:PixelSnapper>
                                <ControlTemplate.Triggers>
                                    <Trigger Property="ContextImageSource" Value="{x:Null}">
                                        <Setter Property="Visibility" TargetName="contextImage" Value="Collapsed"/>
                                    </Trigger>
                                    <Trigger Property="docking:TabbedMdiHost.TabPlacement" Value="Bottom">
                                        <Setter Property="Margin" Value="0,0,-10,2"/>
                                    </Trigger>
                                    <Trigger Property="IsEnabled" Value="False">
                                        <Setter Property="Foreground" Value="{DynamicResource {ComponentResourceKey ResourceId=DocumentTabForegroundDisabled, TypeInTargetAssembly={x:Type docking:DockSite}}}"/>
                                        <Setter Property="Opacity" TargetName="image" Value="0.4"/>
                                        <Setter Property="Opacity" TargetName="contextImage" Value="0.4"/>
                                    </Trigger>
                                    <Trigger Property="IsSelected" Value="True">
                                        <Setter Property="Panel.ZIndex" Value="1"/>
                                        <Setter Property="Margin" Value="0,0,-10,0"/>
                                        <Setter Property="Padding" Value="2,1,4,1"/>
                                    </Trigger>
                                    <Trigger Property="IsEditingTitle" Value="True">
                                        <Setter Property="Visibility" TargetName="title" Value="Hidden"/>
                                        <Setter Property="Visibility" TargetName="PART_TitleTextBox" Value="Visible"/>
                                    </Trigger>
                                    <MultiTrigger>
                                        <MultiTrigger.Conditions>
                                            <Condition Property="docking:Workspace.IsActive" Value="True"/>
                                            <Condition Property="IsSelected" Value="True"/>
                                        </MultiTrigger.Conditions>
                                        <Setter Property="FontWeight" TargetName="title" Value="Bold"/>
                                        <Setter Property="FontWeight" TargetName="PART_TitleTextBox" Value="Bold"/>
                                    </MultiTrigger>
                                    <Trigger Property="docking:TabbedMdiHost.IsImageOnTab" Value="True">
                                        <Setter Property="Margin" TargetName="titlePlaceholder" Value="17,0,0,0"/>
                                        <Setter Property="Visibility" TargetName="image" Value="Visible"/>
                                    </Trigger>
                                    <MultiTrigger>
                                        <MultiTrigger.Conditions>
                                            <Condition Property="CanCloseResolved" Value="True"/>
                                            <Condition Property="docking:TabbedMdiHost.IsCloseButtonOnTab" Value="True"/>
                                        </MultiTrigger.Conditions>
                                        <Setter Property="Visibility" TargetName="closeButton" Value="Visible"/>
                                    </MultiTrigger>
                                </ControlTemplate.Triggers>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                    <Style.BasedOn>
                        <Style TargetType="{x:Type docking:DockingWindow}">
                            <Setter Property="AutomationProperties.Name" Value="{Binding Title, RelativeSource={RelativeSource Self}}"/>
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="{x:Type docking:DockingWindow}">
                                        <ContentPresenter Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}"/>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                        </Style>
                    </Style.BasedOn>
                </Style>
            </Style.BasedOn>
        </Style>
    </Window.Resources>
    
    <docking:DockSite x:Name="dockSite">

        <docking:Workspace >
            <docking:TabbedMdiHost x:Name="tabbedMdiHost" >
                <docking:TabbedMdiContainer SelectionChanged="TabbedMdiContainer_SelectionChanged">
                    <docking:DocumentWindow x:Name="my" Title="Document 1" Description="Text document" 
                         CanClose="True"  ToolTip="No1 document" Style="{DynamicResource DocumentWindowStyle1}">
                        <Button 
                            Content="1" Background="{x:Null}" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="-4"  Click="Button_Click" />
                    </docking:DocumentWindow>
                    <docking:DocumentWindow Title="Document 2" Description="Text document" 
                        FileName="Document2.rtf" CanClose="True"  ToolTip="No2 document~">
                        <Button 
                            Content="2" Background="{x:Null}" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="-4"  Click="Button_Click" />
                    </docking:DocumentWindow>
                </docking:TabbedMdiContainer>
            </docking:TabbedMdiHost>
        </docking:Workspace>

    </docking:DockSite>
</Window>
I just need to insert a new button on the Tab of document.
In order to do that, I created above style by selecting "Edit a template" menu in Blend.

However, there is a serious problem.
Close button is disabled!

Is there another workaround to insert a new control in Document Tab or fix this problem?

Thanks, in advance.

Comments (2)

Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
SeongTae,

The next build of WPF Studio has a new feature where you can set any custom content in the tabs (and a new QuickStart showing how). You'll probably want to use that feature.

For your specific problem here though, Blend didn't copy the Command right. It should have been:
Command="{x:Static docking:DockingCommands.CloseWindow}"

If you are a WPF Studio suite customer, you can download our original XAML theme files right from your account. Those are always better to use than Blend.


Actipro Software Support

Posted 14 years ago by SeongTae Jeong
Avatar
Thanks for your reply.
That's exactly what I want.

I didn't know that Blend cannot produce right XAML code corresponding with Command!
It's very usefule information to me. :) Thanks again.

[Modified at 09/29/2009 08:10 PM]
The latest build of this product (v24.1.1) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.