|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- Control template for docked content within windows manager-->
<ControlTemplate x:Key="DockedContentTabItem"
TargetType="{x:Type TabItem}">
<Border BorderThickness="0"
CornerRadius="2,2,0,0"
Background="{TemplateBinding Background}"
Margin="0,0,2,0">
<DockPanel>
<Button x:Name="CloseButton"
DockPanel.Dock="Right"
Style="{DynamicResource DockPaneButton}"
Margin="0,0,4,0"
VerticalAlignment="Center"
Command="{Binding CloseCommand}"
Background="{DynamicResource DockPaneHoverBackgroundBrush}"
Visibility="Hidden"
Foreground="{TemplateBinding Foreground}"
CommandParameter="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=DataContext}">
<Path Height="16"
Width="16"
Data="M4,4 L12,12 M12,4 L4,12"
Stroke="{TemplateBinding Foreground}" />
</Button>
<ContentPresenter Margin="8,4,4,4"
TextElement.Foreground="{TemplateBinding Foreground}"
VerticalAlignment="Center"
ContentSource="Header">
<ContentPresenter.Resources>
<Style TargetType="{x:Type TextBlock}"
BasedOn="{StaticResource {x:Type TextBlock}}">
<Setter Property="TextTrimming"
Value="CharacterEllipsis" />
</Style>
</ContentPresenter.Resources>
</ContentPresenter>
</DockPanel>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected"
Value="True">
<Setter Property="Background"
Value="{DynamicResource ActiveTabItemBackground}" />
<Setter Property="Background"
TargetName="CloseButton"
Value="{DynamicResource ActiveTabItemCloseButtonHoverBackground}" />
<Setter Property="Visibility"
TargetName="CloseButton"
Value="Visible" />
<Setter Property="Foreground"
Value="Black" />
</Trigger>
<Trigger Property="IsMouseOver"
Value="True">
<Setter Property="Visibility"
TargetName="CloseButton"
Value="Visible" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<!-- Style for illustrating content docking in windows manager -->
<Style x:Key="DockIllustrationContentStyle"
TargetType="{x:Type TabItem}">
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<Grid Background="{DynamicResource DockIllustrationBrush}" Margin="-4"/>
</DataTemplate>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TabItem}">
<Grid SnapsToDevicePixels="true"
Background="{DynamicResource DockIllustrationBrush}"
Width="50"/>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="VerticalContentAlignment" Value="Stretch"/>
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
</Style>
</ResourceDictionary>
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Ashish worked for Microsoft for a number of years in Microsoft Visual Studio (Architect edition) and Windows Live division as a developer. Before that he was a developer consultant mainly involved in distributed service development / architecture. His main interests are distributed software architecture, patterns and practices and mobile device development.
Currently Ashish serves as a Technical Lead at RIM leading next generation BlackBerry media experience and also runs his own company MixModes Inc. specializing in .NET / WPF / Silverlight technologies. You can visit MixModes at http://mixmodes.com or follow it on Twitter @MixModes
In his free time he is an avid painter, hockey player and enjoys travelling. His blog is at: http://ashishkaila.serveblog.net