Files
aistudio-wpf-diagram/AIStudio.Wpf.DiagramApp/Styles/Fluent.xaml
2022-12-05 22:48:00 +08:00

287 lines
24 KiB
XML

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:Fluent="urn:fluent-ribbon"
mc:Ignorable="d">
<Style x:Key="UnSelectedItemContainerStyle" TargetType="{x:Type ListBoxItem}" BasedOn="{StaticResource Fluent.Ribbon.ColorGallery.ListBox.ItemContainerStyle}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Grid Background="Transparent">
<ContentPresenter Margin="{TemplateBinding Padding}" Width="15" Height="15" />
<Border x:Name="outerBorder" BorderThickness="1" Margin="{TemplateBinding Padding}">
<Border x:Name="innerBorder" BorderThickness="1" />
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderBrush" TargetName="outerBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.DarkExtremeHighlightBrush}" />
<Setter Property="BorderBrush" TargetName="innerBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.ExtremeHighlightBrush}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<ControlTemplate TargetType="{x:Type Fluent:ComboBox}" x:Key="ComboboxControlTemplate1">
<ControlTemplate.Resources>
<ResourceDictionary>
<Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}" BasedOn="{StaticResource ScrollBarWhite}" />
<Style x:Key="{x:Type ScrollViewer}" TargetType="{x:Type ScrollViewer}" BasedOn="{StaticResource ScrollViewerStyle}" />
</ResourceDictionary>
</ControlTemplate.Resources>
<Grid Width="Auto" Height="Auto" Background="Transparent">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" Grid.ColumnSpan="1" x:Name="headerAndIconPanel" HorizontalAlignment="Left" Margin="0,0,4,0">
<ContentPresenter x:Name="iconImage" Width="16" Height="16" VerticalAlignment="Center" Margin="3,0,0,0" Content="{Fluent:ObjectToImageConverter {Binding Icon, RelativeSource={RelativeSource TemplatedParent}}, '16,16', {Binding RelativeSource={RelativeSource TemplatedParent}}}" />
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition SharedSizeGroup="{Binding Path=(Fluent:RibbonGroupBoxWrapPanel.SharedSizeGroupName), RelativeSource={RelativeSource TemplatedParent}}" />
</Grid.ColumnDefinitions>
<TextBlock Text="{TemplateBinding Header}" TextWrapping="Wrap" VerticalAlignment="Center" Margin="5,0,0,0" x:Name="headerTextBlock" />
</Grid>
</StackPanel>
<Border Height="Auto" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" x:Name="PART_ContentBorder" Background="{TemplateBinding Background}" Grid.Column="1" Grid.ColumnSpan="1" Width="{TemplateBinding InputWidth}" d:LayoutOverrides="GridBox" HorizontalAlignment="Right">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="13" />
</Grid.ColumnDefinitions>
<Fluent:ToggleButton IsDefinitive="False" x:Name="ToggleButton" Focusable="false" IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" BorderThickness="0" ClickMode="Press" Height="Auto" VerticalAlignment="Stretch" Grid.ColumnSpan="2" Margin="0" Style="{DynamicResource RibbonComboButtonStyle}" CanAddToQuickAccessToolBar="False" />
<ContentPresenter Margin="3,0,3,0" x:Name="PART_ContentSite" IsHitTestVisible="False" Content="{TemplateBinding SelectionBoxItem}" ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}" VerticalAlignment="Center" HorizontalAlignment="Left" />
<Image Margin="0" Stretch="None" x:Name="PART_SelectedImage" IsHitTestVisible="False" VerticalAlignment="Top" HorizontalAlignment="Left" Visibility="Collapsed" Width="Auto" Height="Auto" />
<TextBox x:Name="PART_EditableTextBox" Focusable="True" Style="{x:Null}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" TextWrapping="NoWrap" BorderThickness="0,0,0,0" IsReadOnly="{TemplateBinding IsReadOnly}" Background="{DynamicResource Fluent.Ribbon.Brushes.TextBox.Background}" Foreground="{TemplateBinding Foreground}" CaretBrush="{DynamicResource Fluent.Ribbon.Brushes.TextBox.CaretBrush}" SelectionBrush="{DynamicResource Fluent.Ribbon.Brushes.TextBox.SelectionBrush}" Visibility="Hidden" />
</Grid>
</Border>
<Popup x:Name="PART_Popup" Placement="Bottom" PlacementTarget="{Binding ElementName=PART_ContentBorder}" IsOpen="{TemplateBinding IsDropDownOpen}" AllowsTransparency="True" Focusable="False" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" Margin="0,0,-4,0" VerticalAlignment="Top" Grid.ColumnSpan="2">
<Popup.Resources>
<ResourceDictionary>
<Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}" BasedOn="{StaticResource ScrollBarWhite}" />
</ResourceDictionary>
</Popup.Resources>
<Grid Name="DropDown" SnapsToDevicePixels="True" Margin="0" VerticalAlignment="Top">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="4" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="4" />
</Grid.ColumnDefinitions>
<Rectangle HorizontalAlignment="Left" VerticalAlignment="Top" Width="4" Height="4" Grid.Row="1" Grid.Column="1" StrokeThickness="0" Margin="-1,-1,0,0">
<Rectangle.Fill>
<RadialGradientBrush RadiusX="0.984" Center="0.017,0.002" GradientOrigin="0.017,0.002" RadiusY="1">
<GradientStop Color="#3F000000" Offset="0" />
<GradientStop Color="Transparent" Offset="1" />
</RadialGradientBrush>
</Rectangle.Fill>
</Rectangle>
<Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="-1,3,0,0" VerticalAlignment="Top" Width="4" Height="4" Grid.Column="1" Grid.Row="0">
<Rectangle.Fill>
<RadialGradientBrush Center="0.032,1.01" GradientOrigin="0.032,1.01" RadiusX="0.984" RadiusY="1">
<GradientStop Color="#3F000000" Offset="0" />
<GradientStop Color="Transparent" Offset="1" />
</RadialGradientBrush>
</Rectangle.Fill>
</Rectangle>
<Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="3,-1,0,0" VerticalAlignment="Top" Width="4" Height="4" Grid.Column="0" Grid.Row="1">
<Rectangle.Fill>
<RadialGradientBrush Center="0.996,0.027" GradientOrigin="0.996,0.027" RadiusX="0.984" RadiusY="1">
<GradientStop Color="#3F000000" Offset="0" />
<GradientStop Color="Transparent" Offset="1" />
</RadialGradientBrush>
</Rectangle.Fill>
</Rectangle>
<Rectangle StrokeThickness="0" HorizontalAlignment="Stretch" Margin="7,-1,1,0" VerticalAlignment="Top" Width="Auto" Height="4" Grid.Column="0" Grid.Row="1">
<Rectangle.Fill>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" MappingMode="RelativeToBoundingBox">
<GradientStop Color="#3F000000" Offset="0" />
<GradientStop Color="Transparent" Offset="1" />
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
<Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="-1,7,0,1" VerticalAlignment="Stretch" Width="4" Height="Auto" Grid.Column="1" Grid.Row="0">
<Rectangle.Fill>
<LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5" MappingMode="RelativeToBoundingBox">
<GradientStop Color="#3F000000" Offset="0" />
<GradientStop Color="Transparent" Offset="1" />
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
<Border x:Name="PART_DropDownBorder" Margin="0" MinWidth="{Binding ActualWidth, ElementName=PART_ContentBorder}" SnapsToDevicePixels="True" Background="{DynamicResource Fluent.Ribbon.Brushes.DropDown.BackgroundBrush}" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.DropDown.BorderBrush}" BorderThickness="1" Grid.ColumnSpan="1" HorizontalAlignment="Stretch" VerticalAlignment="Top">
<Grid Width="Auto" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Top" KeyboardNavigation.DirectionalNavigation="Cycle">
<Border VerticalAlignment="Stretch" Width="Auto" Height="Auto" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.DropDown.BackgroundBrush}" BorderThickness="1" />
<Grid Margin="1" HorizontalAlignment="Stretch" VerticalAlignment="Top">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Rectangle Fill="{x:Null}" Stretch="Fill" Stroke="{DynamicResource Fluent.Ribbon.Brushes.Separator.BorderBrush}" HorizontalAlignment="Left" Margin="24,0,0,0" Width="1" Height="Auto" Grid.RowSpan="3" Visibility="Visible" VerticalAlignment="Stretch" />
<ContentControl x:Name="upResizeContent" />
<Grid Grid.Row="1" x:Name="PART_MenuPanel" MaxHeight="{TemplateBinding MaxDropDownHeight}" VerticalAlignment="Top">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<ScrollViewer Focusable="False" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.Control.BorderBrush}" x:Name="PART_ScrollViewer" Background="{DynamicResource WhiteBrush}" Margin="1" SnapsToDevicePixels="True" KeyboardNavigation.DirectionalNavigation="None" VerticalAlignment="Stretch" BorderThickness="0,0,0,1">
<ItemsPresenter KeyboardNavigation.DirectionalNavigation="Contained" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</ScrollViewer>
<ContentPresenter x:Name="menuPresenter" ContentSource="Menu" Grid.Row="1" KeyboardNavigation.DirectionalNavigation="None" VerticalAlignment="Top" />
</Grid>
<ContentControl x:Name="downResizeContent" Grid.Row="2">
<Border RenderTransformOrigin="0.5, 0.5" x:Name="resizeBorder" HorizontalAlignment="Stretch" VerticalAlignment="Top" Height="11" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.DropDown.Resize.BorderBrush}" BorderThickness="0,1,0,0" Background="{DynamicResource Fluent.Ribbon.Brushes.DropDown.Resize.BackgroundBrush}">
<Grid>
<Thumb x:Name="PART_ResizeVerticalThumb" HorizontalAlignment="Stretch" Margin="0,0,0,-90" Width="Auto" Height="10" VerticalAlignment="Top" Cursor="SizeNS" Template="{DynamicResource ResizeVerticalThumbControlTemplate}" />
<Thumb x:Name="PART_ResizeBothThumb" HorizontalAlignment="Right" Margin="0,0,0,-90" Width="10" Height="10" VerticalAlignment="Top" Cursor="SizeNWSE" Template="{DynamicResource ResizeBothThumbControlTemplate}" />
</Grid>
</Border>
</ContentControl>
</Grid>
</Grid>
</Border>
</Grid>
</Popup>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="Menu" Value="{x:Null}">
<Setter Property="BorderThickness" TargetName="PART_ScrollViewer" Value="0" />
</Trigger>
<Trigger Property="ResizeMode" Value="None">
<Setter Property="Visibility" TargetName="resizeBorder" Value="Collapsed" />
</Trigger>
<Trigger Property="ResizeMode" Value="Both">
<Setter Property="Visibility" TargetName="PART_ResizeVerticalThumb" Value="Collapsed" />
<Setter Property="Visibility" TargetName="PART_ResizeBothThumb" Value="Visible" />
<Setter Property="Visibility" TargetName="resizeBorder" Value="Visible" />
</Trigger>
<Trigger Property="ResizeMode" Value="Vertical">
<Setter Property="Visibility" TargetName="PART_ResizeBothThumb" Value="Collapsed" />
<Setter Property="Visibility" TargetName="PART_ResizeVerticalThumb" Value="Visible" />
<Setter Property="Visibility" TargetName="resizeBorder" Value="Visible" />
</Trigger>
<Trigger Property="Icon" Value="{x:Null}">
<Setter Property="Visibility" TargetName="iconImage" Value="Collapsed" />
</Trigger>
<Trigger Property="Size" Value="Middle">
<Setter Property="Visibility" TargetName="headerTextBlock" Value="Collapsed" />
<Setter Property="HorizontalAlignment" TargetName="PART_ContentBorder" Value="Stretch" />
</Trigger>
<Trigger Property="Size" Value="Small">
<Setter Property="Visibility" TargetName="headerAndIconPanel" Value="Collapsed" />
<Setter Property="HorizontalAlignment" TargetName="PART_ContentBorder" Value="Stretch" />
</Trigger>
<Trigger Property="InputWidth" Value="NaN">
<Setter Property="HorizontalAlignment" TargetName="PART_ContentBorder" Value="Stretch" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="IsEnabled" TargetName="PART_EditableTextBox" Value="False" />
<Setter Property="Background" TargetName="PART_ContentBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.TextBox.Disabled.Background}" />
<Setter Property="BorderBrush" TargetName="PART_ContentBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.TextBox.Disabled.BorderBrush}" />
<Setter Property="BorderBrush" TargetName="PART_EditableTextBox" Value="{DynamicResource Fluent.Ribbon.Brushes.TextBox.Disabled.Background}" />
<Setter Property="Opacity" TargetName="iconImage" Value="0.5" />
<Setter Property="Opacity" TargetName="headerTextBlock" Value="0.5" />
<Setter Property="Effect" TargetName="iconImage">
<Setter.Value>
<Fluent:GrayscaleEffect />
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderBrush" TargetName="PART_ContentBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.TextBox.MouseOver.BorderBrush}" />
<Setter Property="Background" TargetName="PART_EditableTextBox" Value="{DynamicResource Fluent.Ribbon.Brushes.TextBox.MouseOver.Background}" />
<Setter Property="Background" TargetName="PART_ContentBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.TextBox.MouseOver.Background}" />
</Trigger>
<Trigger Property="IsKeyboardFocusWithin" Value="True">
<Setter Property="BorderBrush" TargetName="PART_ContentBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.TextBox.MouseOver.BorderBrush}" />
<Setter Property="Background" TargetName="PART_EditableTextBox" Value="{DynamicResource Fluent.Ribbon.Brushes.TextBox.MouseOver.Background}" />
<Setter Property="Background" TargetName="PART_ContentBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.TextBox.MouseOver.Background}" />
</Trigger>
<Trigger Property="HasItems" Value="false">
<Setter TargetName="PART_DropDownBorder" Property="MinHeight" Value="95" />
</Trigger>
<Trigger Property="IsGrouping" Value="true">
<Setter Property="ScrollViewer.CanContentScroll" Value="false" />
</Trigger>
<Trigger Property="IsEditable" Value="true">
<Setter Property="IsTabStop" Value="false" />
<Setter TargetName="PART_EditableTextBox" Property="Visibility" Value="Visible" />
<Setter TargetName="PART_ContentSite" Property="Visibility" Value="Hidden" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<ControlTemplate x:Key="RibbonDropDownButtonControlTemplate1" TargetType="{x:Type Fluent:DropDownButton}">
<Grid>
<Border x:Name="PART_ButtonBorder" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}" Height="Auto">
<StackPanel x:Name="stackPanel" Margin="{TemplateBinding Padding}" Width="Auto" Orientation="Vertical">
<ContentPresenter x:Name="iconImage" Content="{Binding Icon, RelativeSource={RelativeSource TemplatedParent}}" Width="Auto" SnapsToDevicePixels="True" />
</StackPanel>
</Border>
<Popup x:Name="PART_Popup" Placement="Bottom" IsOpen="{TemplateBinding IsDropDownOpen}" AllowsTransparency="True" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" Margin="0,0,-4,0" VerticalAlignment="Top" Grid.ColumnSpan="2">
<Grid Name="DropDown" SnapsToDevicePixels="True" Margin="0" VerticalAlignment="Top">
<Border x:Name="PART_DropDownBorder" MinWidth="{TemplateBinding ActualWidth}" SnapsToDevicePixels="True" Background="{DynamicResource Fluent.Ribbon.Brushes.DropDown.BackgroundBrush}" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.DropDown.BorderBrush}" BorderThickness="1" HorizontalAlignment="Stretch" VerticalAlignment="Top">
<Grid Width="Auto" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Top">
<Border VerticalAlignment="Top" Width="Auto" Height="Auto" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.DropDown.BackgroundBrush}" BorderThickness="1" />
<Grid Margin="1" HorizontalAlignment="Stretch" VerticalAlignment="Top">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<ScrollViewer x:Name="PART_ScrollViewer" Style="{DynamicResource MenuScrollViewer}" IsTabStop="False" Margin="1" MaxHeight="{TemplateBinding MaxDropDownHeight}" SnapsToDevicePixels="True" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Hidden">
<ItemsPresenter KeyboardNavigation.DirectionalNavigation="Local" />
</ScrollViewer>
<Border x:Name="resizeBorder" HorizontalAlignment="Stretch" VerticalAlignment="Top" Height="11" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.DropDown.Resize.BorderBrush}" BorderThickness="0,1,0,0" Grid.Row="1" Background="{DynamicResource Fluent.Ribbon.Brushes.DropDown.Resize.BackgroundBrush}">
<Grid>
<Thumb x:Name="PART_ResizeVerticalThumb" HorizontalAlignment="Stretch" Margin="0,0,0,-90" Width="Auto" Height="10" VerticalAlignment="Top" Cursor="SizeNS" Template="{DynamicResource ResizeVerticalThumbControlTemplate}" />
<Thumb x:Name="PART_ResizeBothThumb" HorizontalAlignment="Right" Margin="0,0,0,-90" Width="10" Height="10" VerticalAlignment="Top" Cursor="SizeNWSE" Template="{DynamicResource ResizeBothThumbControlTemplate}" />
</Grid>
</Border>
</Grid>
</Grid>
</Border>
</Grid>
</Popup>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="ResizeMode" Value="None">
<Setter Property="Visibility" TargetName="resizeBorder" Value="Collapsed" />
</Trigger>
<Trigger Property="ResizeMode" Value="Both">
<Setter Property="Visibility" TargetName="PART_ResizeVerticalThumb" Value="Collapsed" />
<Setter Property="Visibility" TargetName="PART_ResizeBothThumb" Value="Visible" />
<Setter Property="Visibility" TargetName="resizeBorder" Value="Visible" />
</Trigger>
<Trigger Property="ResizeMode" Value="Vertical">
<Setter Property="Visibility" TargetName="PART_ResizeBothThumb" Value="Collapsed" />
<Setter Property="Visibility" TargetName="PART_ResizeVerticalThumb" Value="Visible" />
<Setter Property="Visibility" TargetName="resizeBorder" Value="Visible" />
</Trigger>
<Trigger Property="IsDropDownOpen" Value="True">
<Setter Property="BorderBrush" TargetName="PART_ButtonBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.BorderBrush}" />
<Setter Property="Background" TargetName="PART_ButtonBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.Background}" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" TargetName="iconImage" Value="0.5" />
<Setter Property="Effect" TargetName="iconImage">
<Setter.Value>
<Fluent:GrayscaleEffect />
</Setter.Value>
</Setter>
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsMouseOver" Value="True" />
<Condition Property="IsDropDownOpen" Value="False" />
</MultiTrigger.Conditions>
<Setter Property="Background" TargetName="PART_ButtonBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.Background}" />
<Setter Property="BorderBrush" TargetName="PART_ButtonBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.BorderBrush}" />
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</ResourceDictionary>