mirror of
https://github.com/ZuneDev/ZuneModdingHelper.git
synced 2026-07-27 13:12:21 -07:00
[WIP] Simpler ComboxBox starting theme
This commit is contained in:
@@ -21,7 +21,6 @@
|
||||
<Style TargetType="Button" BasedOn="{StaticResource ActionButtonStyle}"/>
|
||||
<Style TargetType="TextBox" BasedOn="{StaticResource ZuneTextBoxBaseStyle}"/>
|
||||
<Style TargetType="ComboBox" BasedOn="{StaticResource ZuneComboBoxStyle}"/>
|
||||
<Style TargetType="ComboBoxItem" BasedOn="{StaticResource ZuneComboBoxItemStyle}"/>
|
||||
|
||||
<FontFamily x:Key="ZMHIcons">Assets/ZMH_Icons.ttf#ZMHIcons</FontFamily>
|
||||
<FontFamily x:Key="SegoeMDL2">Segoe MDL2 Assets</FontFamily>
|
||||
|
||||
@@ -795,199 +795,118 @@
|
||||
<GradientStop Color="#D5D5D5" Offset="1"/>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<ControlTemplate x:Key="ZuneComboBoxTemplate" TargetType="{x:Type ComboBox}">
|
||||
<Border x:Name="ComboBoxBorder" BorderThickness="{TemplateBinding BorderThickness}">
|
||||
<Grid x:Name="templateRoot" SnapsToDevicePixels="true">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition MinWidth="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" Width="0"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Popup x:Name="PART_Popup"
|
||||
AllowsTransparency="true"
|
||||
Margin="1"
|
||||
Placement="Bottom"
|
||||
Grid.ColumnSpan="2"
|
||||
IsOpen="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}">
|
||||
<theme:SystemDropShadowChrome x:Name="shadow"
|
||||
Color="Transparent"
|
||||
MaxHeight="{TemplateBinding MaxDropDownHeight}"
|
||||
MinWidth="{Binding ActualWidth, ElementName=templateRoot}">
|
||||
<Border x:Name="DropDownBorder"
|
||||
BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}"
|
||||
Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"
|
||||
BorderThickness="1">
|
||||
<ScrollViewer x:Name="DropDownScrollViewer">
|
||||
<Grid x:Name="grid" RenderOptions.ClearTypeHint="Enabled">
|
||||
<Canvas x:Name="canvas"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
Height="0"
|
||||
Width="0">
|
||||
<Rectangle x:Name="OpaqueRect"
|
||||
Fill="{Binding Background, ElementName=DropDownBorder}"
|
||||
Height="{Binding ActualHeight, ElementName=DropDownBorder}"
|
||||
Width="{Binding ActualWidth, ElementName=DropDownBorder}"/>
|
||||
</Canvas>
|
||||
<ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
</theme:SystemDropShadowChrome>
|
||||
</Popup>
|
||||
<ToggleButton x:Name="toggleButton"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Grid.ColumnSpan="2" />
|
||||
<!--Style="{StaticResource č}"-->
|
||||
<ContentPresenter x:Name="contentPresenter"
|
||||
Content="{TemplateBinding SelectionBoxItem}"
|
||||
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
|
||||
ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
|
||||
ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}"
|
||||
IsHitTestVisible="false"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
<SolidColorBrush x:Key="ComboBoxNormalBorderBrush" Color="#e3e9ef" />
|
||||
<SolidColorBrush x:Key="ComboBoxNormalBackgroundBrush" Color="#fff" />
|
||||
<SolidColorBrush x:Key="ComboBoxDisabledForegroundBrush" Color="#888" />
|
||||
<SolidColorBrush x:Key="ComboBoxDisabledBackgroundBrush" Color="#eee" />
|
||||
<SolidColorBrush x:Key="ComboBoxDisabledBorderBrush" Color="#888" />
|
||||
|
||||
<ControlTemplate x:Key="ZuneComboBoxToggleButton" TargetType="ToggleButton">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="20" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Border Grid.ColumnSpan="2" Name="Border"
|
||||
BorderBrush="{StaticResource ComboBoxNormalBorderBrush}"
|
||||
CornerRadius="0" BorderThickness="1, 1, 1, 1"
|
||||
Background="{StaticResource ComboBoxNormalBackgroundBrush}" />
|
||||
<Border Grid.Column="1" Margin="1, 1, 1, 1" BorderBrush="#444" Name="ButtonBorder"
|
||||
CornerRadius="0, 0, 0, 0" BorderThickness="0, 0, 0, 0"
|
||||
Background="{StaticResource ComboBoxNormalBackgroundBrush}" />
|
||||
|
||||
<Path Name="Arrow" Grid.Column="1"
|
||||
Data="M0,0 L0,2 L4,6 L8,2 L8,0 L4,4 z"
|
||||
HorizontalAlignment="Center" Fill="#444"
|
||||
VerticalAlignment="Center" />
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="HasDropShadow" SourceName="PART_Popup" Value="true">
|
||||
<Setter Property="Margin" TargetName="shadow" Value="5"/>
|
||||
<Setter Property="Color" TargetName="shadow" Value="#71000000"/>
|
||||
<Trigger Property="UIElement.IsMouseOver" Value="True">
|
||||
<Setter Property="Panel.Background" TargetName="ButtonBorder" Value="WhiteSmoke"/>
|
||||
</Trigger>
|
||||
<Trigger Property="HasItems" Value="false">
|
||||
<Setter Property="Height" TargetName="DropDownBorder" Value="95"/>
|
||||
<Trigger Property="ToggleButton.IsChecked" Value="True">
|
||||
<Setter Property="Panel.Background" TargetName="ButtonBorder" Value="WhiteSmoke"/>
|
||||
<Setter Property="Shape.Fill" TargetName="Arrow" Value="#FF8D979E"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsMouseOver" Value="true">
|
||||
<Setter Property="BorderBrush" Value="#FA6EC9"/>
|
||||
</Trigger>
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
<Condition Property="IsGrouping" Value="true" />
|
||||
<Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false" />
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
|
||||
</MultiTrigger>
|
||||
<Trigger Property="ScrollViewer.CanContentScroll" SourceName="DropDownScrollViewer" Value="false">
|
||||
<Setter Property="Canvas.Top" TargetName="OpaqueRect" Value="{Binding VerticalOffset, ElementName=DropDownScrollViewer}"/>
|
||||
<Setter Property="Canvas.Left" TargetName="OpaqueRect" Value="{Binding HorizontalOffset, ElementName=DropDownScrollViewer}"/>
|
||||
<Trigger Property="UIElement.IsEnabled" Value="False">
|
||||
<Setter Property="Panel.Background" TargetName="Border" Value="{StaticResource ComboBoxDisabledBackgroundBrush}"/>
|
||||
<Setter Property="Panel.Background" TargetName="ButtonBorder" Value="{StaticResource ComboBoxDisabledBackgroundBrush}"/>
|
||||
<Setter Property="Border.BorderBrush" TargetName="ButtonBorder" Value="{StaticResource ComboBoxDisabledBorderBrush}"/>
|
||||
<Setter Property="TextElement.Foreground" Value="{StaticResource ComboBoxDisabledForegroundBrush}"/>
|
||||
<Setter Property="Shape.Fill" TargetName="Arrow" Value="#999"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
|
||||
<Style x:Key="ZuneComboBoxStyle" TargetType="{x:Type ComboBox}">
|
||||
<!--<Setter Property="FocusVisualStyle" Value="{StaticResource Ý}"/>-->
|
||||
<Setter Property="Background" Value="{StaticResource NormalComboBoxBackgroundBrush}"/>
|
||||
<Setter Property="Foreground" Value="#606060"/>
|
||||
<Setter Property="TextElement.FontWeight" Value="SemiBold"/>
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
<Style x:Key="ZuneComboBoxStyle" TargetType="{x:Type ComboBox}">
|
||||
<Setter Property="UIElement.SnapsToDevicePixels" Value="True"/>
|
||||
<Setter Property="FrameworkElement.OverridesDefaultStyle" Value="True"/>
|
||||
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
|
||||
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
|
||||
<Setter Property="Padding" Value="6,3,5,3"/>
|
||||
<Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
|
||||
<Setter Property="ScrollViewer.PanningMode" Value="Both"/>
|
||||
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
|
||||
<Setter Property="Template" Value="{StaticResource ZuneComboBoxTemplate}" />
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsEditable" Value="true">
|
||||
<Setter Property="IsTabStop" Value="false"/>
|
||||
<Setter Property="Padding" Value="2"/>
|
||||
<!--<Setter Property="Template" Value="{StaticResource Ď}"/>-->
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<SolidColorBrush x:Key="đ" Color="#1F26A0DA" />
|
||||
<SolidColorBrush x:Key="Ē" Color="#A826A0DA" />
|
||||
<SolidColorBrush x:Key="ē" Color="#3D26A0DA" />
|
||||
<SolidColorBrush x:Key="Ĕ" Color="#FF26A0DA" />
|
||||
<SolidColorBrush x:Key="ĕ" Color="#2E0080FF" />
|
||||
<SolidColorBrush x:Key="Ė" Color="#99006CD9" />
|
||||
<SolidColorBrush x:Key="ė" Color="#3DDADADA" />
|
||||
<SolidColorBrush x:Key="Ę" Color="#FFDADADA" />
|
||||
<SolidColorBrush x:Key="ę" Color="#FF26A0DA" />
|
||||
<SolidColorBrush x:Key="Ě" Color="#5426A0DA" />
|
||||
<SolidColorBrush x:Key="ě" Color="#FF26A0DA" />
|
||||
|
||||
<Style x:Key="ZuneComboBoxItemStyle" TargetType="{x:Type ComboBoxItem}">
|
||||
<Setter Property="SnapsToDevicePixels" Value="True" />
|
||||
<Setter Property="Padding" Value="4,1" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="BorderBrush" Value="Transparent" />
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
<Setter Property="FocusVisualStyle" Value="{StaticResource Ý}" />
|
||||
<Setter Property="Template">
|
||||
<Setter Property="ScrollViewer.CanContentScroll" Value="True"/>
|
||||
<Setter Property="TextElement.Foreground" Value="Black"/>
|
||||
<Setter Property="FrameworkElement.FocusVisualStyle" Value="{x:Null}"/>
|
||||
<Setter Property="Control.Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ComboBoxItem}">
|
||||
<Border x:Name="Bd"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Background="{TemplateBinding Background}"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
SnapsToDevicePixels="true">
|
||||
<ContentPresenter
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
||||
</Border>
|
||||
<ControlTemplate TargetType="ComboBox">
|
||||
<Grid>
|
||||
<ToggleButton Name="ToggleButton" Grid.Column="2"
|
||||
ClickMode="Press" Focusable="False"
|
||||
IsChecked="{Binding Path=IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
|
||||
Template="{StaticResource ZuneComboBoxToggleButton}"/>
|
||||
|
||||
<ContentPresenter Name="ContentSite" Margin="5, 3, 23, 3" IsHitTestVisible="False"
|
||||
HorizontalAlignment="Left" VerticalAlignment="Center"
|
||||
Content="{TemplateBinding ComboBox.SelectionBoxItem}"
|
||||
ContentTemplate="{TemplateBinding ComboBox.SelectionBoxItemTemplate}"
|
||||
ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"/>
|
||||
<TextBox Name="PART_EditableTextBox" Margin="3, 3, 23, 3"
|
||||
IsReadOnly="{TemplateBinding IsReadOnly}"
|
||||
Visibility="Hidden" Background="Transparent"
|
||||
HorizontalAlignment="Left" VerticalAlignment="Center"
|
||||
Focusable="True">
|
||||
<TextBox.Template>
|
||||
<ControlTemplate TargetType="TextBox" >
|
||||
<Border Name="PART_ContentHost" Focusable="False" />
|
||||
</ControlTemplate>
|
||||
</TextBox.Template>
|
||||
</TextBox>
|
||||
<!-- Popup showing items -->
|
||||
<Popup Name="Popup" Placement="Bottom"
|
||||
Focusable="False" AllowsTransparency="True"
|
||||
IsOpen="{TemplateBinding ComboBox.IsDropDownOpen}"
|
||||
PopupAnimation="Slide">
|
||||
<Grid Name="DropDown" SnapsToDevicePixels="True"
|
||||
MinWidth="{TemplateBinding FrameworkElement.ActualWidth}"
|
||||
MaxHeight="{TemplateBinding ComboBox.MaxDropDownHeight}">
|
||||
<Border Name="DropDownBorder" Background="White" Margin="0, 1, 0, 0"
|
||||
CornerRadius="0" BorderThickness="1,1,1,1"
|
||||
BorderBrush="{StaticResource ComboBoxNormalBorderBrush}"/>
|
||||
<ScrollViewer Margin="4" SnapsToDevicePixels="True">
|
||||
<ItemsPresenter KeyboardNavigation.DirectionalNavigation="Contained" />
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</Popup>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter TargetName="Bd" Property="TextElement.Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
|
||||
<Trigger Property="ItemsControl.HasItems" Value="False">
|
||||
<Setter Property="FrameworkElement.MinHeight" TargetName="DropDownBorder" Value="95"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="True">
|
||||
<Setter TargetName="Bd" Property="TextElement.Foreground" Value="#3D4042" />
|
||||
<Trigger Property="UIElement.IsEnabled" Value="False">
|
||||
<Setter Property="TextElement.Foreground" Value="{StaticResource ComboBoxDisabledForegroundBrush}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="ItemsControl.IsGrouping" Value="True">
|
||||
<Setter Property="ScrollViewer.CanContentScroll" Value="False"/>
|
||||
</Trigger>
|
||||
<Trigger Property="ComboBox.IsEditable" Value="True">
|
||||
<Setter Property="KeyboardNavigation.IsTabStop" Value="False"/>
|
||||
<Setter Property="UIElement.Visibility" TargetName="PART_EditableTextBox" Value="Visible"/>
|
||||
<Setter Property="UIElement.Visibility" TargetName="ContentSite" Value="Hidden"/>
|
||||
</Trigger>
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
<Condition Property="IsSelected" Value="False" />
|
||||
<Condition Property="IsMouseOver" Value="True" />
|
||||
<Condition Property="UIElement.IsKeyboardFocused" Value="False" />
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter TargetName="Bd" Property="Background" Value="#E7E8E8" />
|
||||
</MultiTrigger>
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
<Condition Property="IsSelected" Value="True" />
|
||||
<Condition Property="IsMouseOver" Value="False" />
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter TargetName="Bd" Property="Background" Value="#D8D8D9" />
|
||||
<Setter TargetName="Bd" Property="TextElement.Foreground" Value="#1D1D1D" />
|
||||
</MultiTrigger>
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
<Condition Property="IsSelected" Value="True" />
|
||||
<Condition Property="IsMouseOver" Value="True" />
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter TargetName="Bd" Property="Background" Value="#E7E8E8" />
|
||||
</MultiTrigger>
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
<Condition Property="IsSelected" Value="False" />
|
||||
<Condition Property="IsMouseOver" Value="True" />
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter TargetName="Bd" Property="Background" Value="#E7E8E8" />
|
||||
</MultiTrigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- Focus Visual -->
|
||||
<Style x:Key="Ý">
|
||||
<Setter Property="Control.Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate>
|
||||
<Rectangle Margin="2" SnapsToDevicePixels="true" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" StrokeThickness="1" StrokeDashArray="1 2"/>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
Reference in New Issue
Block a user