Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:Behaviours="clr-namespace:MahApps.Metro.Behaviours" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Controls="clr-namespace:MahApps.Metro.Controls">
- <ResourceDictionary.MergedDictionaries>
- <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/VS/Colors.xaml" />
- <ResourceDictionary>
- <!-- General -->
- <SolidColorBrush x:Key="BackgroundHighlighted" Color="#54545C" />
- <SolidColorBrush x:Key="BorderBrushHighlighted" Color="#6A6A75" />
- <SolidColorBrush x:Key="BackgroundSelected" Color="#CCcb0000" />
- <SolidColorBrush x:Key="BorderBrushSelected" Color="#1C97EA" />
- <SolidColorBrush x:Key="BackgroundNormal" Color="#3F3F46" />
- <SolidColorBrush x:Key="BorderBrushNormal" Color="#54545C" />
- <!-- Close Button -->
- <SolidColorBrush x:Key="CloseButtonBackgroundHighlighted" Color="#39ADFB" />
- <SolidColorBrush x:Key="CloseButtonBackgroundPressed" Color="#084E7D" />
- <SolidColorBrush x:Key="CloseButtonStroke" Color="#AAFFFFFF" />
- <SolidColorBrush x:Key="CloseButtonStrokeHighlighted" Color="#FFFFFF" />
- </ResourceDictionary>
- </ResourceDictionary.MergedDictionaries>
- <Style x:Key="StandardTabControl" TargetType="{x:Type TabControl}">
- <Style.Resources>
- <Style TargetType="{x:Type TabItem}">
- <Setter Property="Background" Value="Transparent" />
- <Setter Property="FocusVisualStyle" Value="{x:Null}" />
- <Setter Property="Foreground" Value="{StaticResource Foreground}" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type TabItem}">
- <Grid Height="30"
- Background="{TemplateBinding Background}"
- SnapsToDevicePixels="true">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="25" />
- </Grid.ColumnDefinitions>
- <ContentPresenter Grid.Column="0"
- Margin="10 0 10 0"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- ContentSource="Header" />
- <Button Grid.Column="1"
- Width="15"
- Height="15"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Command="{Binding Path=CloseCommand}"
- DockPanel.Dock="Right">
- <Button.Style>
- <Style TargetType="{x:Type Button}">
- <Setter Property="Background" Value="Transparent" />
- <Setter Property="Cursor" Value="Hand" />
- <Setter Property="Focusable" Value="False" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type Button}">
- <Grid Background="{TemplateBinding Background}">
- <Path x:Name="ButtonPath"
- Margin="2"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Stroke="{DynamicResource CloseButtonStroke}"
- StrokeThickness="2"
- Data="M0,0 L1,1 M0,1 L1,0"
- Stretch="Uniform"
- StrokeEndLineCap="Flat"
- StrokeStartLineCap="Flat" />
- </Grid>
- <ControlTemplate.Triggers>
- <MultiDataTrigger>
- <MultiDataTrigger.Conditions>
- <Condition Binding="{Binding IsSelected, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=TabItem}}" Value="false" />
- <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=TabItem}}" Value="false" />
- </MultiDataTrigger.Conditions>
- <MultiDataTrigger.Setters>
- <Setter Property="Visibility" Value="Hidden" />
- </MultiDataTrigger.Setters>
- </MultiDataTrigger>
- <Trigger Property="IsEnabled" Value="False">
- <Setter Property="Visibility" Value="Hidden" />
- </Trigger>
- <Trigger Property="IsMouseOver" Value="True">
- <Setter Property="Background" Value="{DynamicResource CloseButtonBackgroundHighlighted}" />
- <Setter TargetName="ButtonPath" Property="Stroke" Value="{DynamicResource CloseButtonStrokeHighlighted}" />
- </Trigger>
- <Trigger Property="IsPressed" Value="true">
- <Setter Property="Background" Value="{DynamicResource CloseButtonBackgroundPressed}" />
- <Setter TargetName="ButtonPath" Property="Margin" Value="2.5 2.5 1.5 1.5" />
- <Setter TargetName="ButtonPath" Property="Stroke" Value="{DynamicResource CloseButtonStroke}" />
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- </Button.Style>
- </Button>
- </Grid>
- <ControlTemplate.Triggers>
- <Trigger Property="IsSelected" Value="false">
- <Setter Property="Background" Value="Transparent" />
- </Trigger>
- <Trigger Property="IsMouseOver" Value="true">
- <Setter Property="Background" Value="{DynamicResource BorderBrushSelected}" />
- </Trigger>
- <Trigger Property="IsSelected" Value="true">
- <Setter Property="Background" Value="{DynamicResource BackgroundSelected}" />
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- </Style.Resources>
- <Setter Property="Controls:TabControlHelper.Transition" Value="Left" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type TabControl}">
- <Grid ClipToBounds="{TemplateBinding ClipToBounds}"
- KeyboardNavigation.TabNavigation="Local"
- SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
- <Grid.ColumnDefinitions>
- <ColumnDefinition x:Name="ColumnDefinition0" />
- <ColumnDefinition x:Name="ColumnDefinition1" Width="0" />
- </Grid.ColumnDefinitions>
- <Grid.RowDefinitions>
- <RowDefinition x:Name="RowDefinition0" Height="Auto" />
- <RowDefinition x:Name="RowDefinition1" Height="*" />
- </Grid.RowDefinitions>
- <TabPanel x:Name="HeaderPanel"
- Grid.Row="0"
- Grid.Column="0"
- Panel.ZIndex="1"
- IsItemsHost="True"
- KeyboardNavigation.TabIndex="1" />
- <Border x:Name="ContentPanel"
- Grid.Row="1"
- Grid.Column="0"
- BorderBrush="{DynamicResource BackgroundSelected}"
- Background="{DynamicResource Background}"
- KeyboardNavigation.DirectionalNavigation="Contained"
- KeyboardNavigation.TabIndex="2"
- KeyboardNavigation.TabNavigation="Local">
- <Controls:TransitioningContentControl Behaviours:ReloadBehavior.OnSelectedTabChanged="True"
- RestartTransitionOnContentChange="True"
- Transition="{TemplateBinding Controls:TabControlHelper.Transition}">
- <ContentPresenter x:Name="PART_SelectedContentHost"
- Margin="{TemplateBinding Padding}"
- ContentSource="SelectedContent"
- SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
- </Controls:TransitioningContentControl>
- </Border>
- </Grid>
- <ControlTemplate.Triggers>
- <Trigger Property="TabStripPlacement" Value="Bottom">
- <Setter TargetName="ContentPanel" Property="Grid.Row" Value="0" />
- <Setter TargetName="HeaderPanel" Property="Grid.Row" Value="1" />
- <Setter TargetName="RowDefinition0" Property="Height" Value="*" />
- <Setter TargetName="RowDefinition1" Property="Height" Value="Auto" />
- </Trigger>
- <Trigger Property="TabStripPlacement" Value="Left">
- <Setter Property="Controls:TabControlHelper.Transition" Value="Right" />
- <Setter TargetName="ColumnDefinition0" Property="Width" Value="Auto" />
- <Setter TargetName="ColumnDefinition1" Property="Width" Value="*" />
- <Setter TargetName="ContentPanel" Property="Grid.Column" Value="1" />
- <Setter TargetName="ContentPanel" Property="Grid.Row" Value="0" />
- <Setter TargetName="HeaderPanel" Property="Grid.Column" Value="0" />
- <Setter TargetName="HeaderPanel" Property="Grid.Row" Value="0" />
- <Setter TargetName="RowDefinition0" Property="Height" Value="*" />
- <Setter TargetName="RowDefinition1" Property="Height" Value="0" />
- </Trigger>
- <Trigger Property="TabStripPlacement" Value="Right">
- <Setter TargetName="ColumnDefinition0" Property="Width" Value="*" />
- <Setter TargetName="ColumnDefinition1" Property="Width" Value="Auto" />
- <Setter TargetName="ContentPanel" Property="Grid.Column" Value="0" />
- <Setter TargetName="ContentPanel" Property="Grid.Row" Value="0" />
- <Setter TargetName="HeaderPanel" Property="Grid.Column" Value="1" />
- <Setter TargetName="HeaderPanel" Property="Grid.Row" Value="0" />
- <Setter TargetName="RowDefinition0" Property="Height" Value="*" />
- <Setter TargetName="RowDefinition1" Property="Height" Value="0" />
- </Trigger>
- <Trigger Property="IsEnabled" Value="False">
- <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <DataTemplate x:Key="ClosableTabItemTemplate">
- <DockPanel>
- <ContentPresenter VerticalAlignment="Center" Content="{Binding DisplayName}">
- <ContentPresenter.Resources>
- <Style TargetType="TextBlock">
- <Setter Property="FontSize" Value="20" />
- <Setter Property="Foreground" Value="{StaticResource Foreground}" />
- </Style>
- </ContentPresenter.Resources>
- </ContentPresenter>
- </DockPanel>
- </DataTemplate>
- <!-- This template explains how to render the 'Workspace' content area in the main window. -->
- <DataTemplate x:Key="WorkspacesTemplate">
- <TabControl Margin="0"
- Style="{DynamicResource StandardTabControl}"
- IsSynchronizedWithCurrentItem="True"
- ItemTemplate="{StaticResource ClosableTabItemTemplate}"
- ItemsSource="{Binding}" />
- </DataTemplate>
- </ResourceDictionary>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement