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="Button" BasedOn="{StaticResource ActionButtonStyle}"/>
|
||||||
<Style TargetType="TextBox" BasedOn="{StaticResource ZuneTextBoxBaseStyle}"/>
|
<Style TargetType="TextBox" BasedOn="{StaticResource ZuneTextBoxBaseStyle}"/>
|
||||||
<Style TargetType="ComboBox" BasedOn="{StaticResource ZuneComboBoxStyle}"/>
|
<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="ZMHIcons">Assets/ZMH_Icons.ttf#ZMHIcons</FontFamily>
|
||||||
<FontFamily x:Key="SegoeMDL2">Segoe MDL2 Assets</FontFamily>
|
<FontFamily x:Key="SegoeMDL2">Segoe MDL2 Assets</FontFamily>
|
||||||
|
|||||||
@@ -795,199 +795,118 @@
|
|||||||
<GradientStop Color="#D5D5D5" Offset="1"/>
|
<GradientStop Color="#D5D5D5" Offset="1"/>
|
||||||
</LinearGradientBrush>
|
</LinearGradientBrush>
|
||||||
|
|
||||||
<ControlTemplate x:Key="ZuneComboBoxTemplate" TargetType="{x:Type ComboBox}">
|
<SolidColorBrush x:Key="ComboBoxNormalBorderBrush" Color="#e3e9ef" />
|
||||||
<Border x:Name="ComboBoxBorder" BorderThickness="{TemplateBinding BorderThickness}">
|
<SolidColorBrush x:Key="ComboBoxNormalBackgroundBrush" Color="#fff" />
|
||||||
<Grid x:Name="templateRoot" SnapsToDevicePixels="true">
|
<SolidColorBrush x:Key="ComboBoxDisabledForegroundBrush" Color="#888" />
|
||||||
<Grid.ColumnDefinitions>
|
<SolidColorBrush x:Key="ComboBoxDisabledBackgroundBrush" Color="#eee" />
|
||||||
<ColumnDefinition Width="*"/>
|
<SolidColorBrush x:Key="ComboBoxDisabledBorderBrush" Color="#888" />
|
||||||
<ColumnDefinition MinWidth="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" Width="0"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
<ControlTemplate x:Key="ZuneComboBoxToggleButton" TargetType="ToggleButton">
|
||||||
<Popup x:Name="PART_Popup"
|
<Grid>
|
||||||
AllowsTransparency="true"
|
<Grid.ColumnDefinitions>
|
||||||
Margin="1"
|
<ColumnDefinition />
|
||||||
Placement="Bottom"
|
<ColumnDefinition Width="20" />
|
||||||
Grid.ColumnSpan="2"
|
</Grid.ColumnDefinitions>
|
||||||
IsOpen="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
|
<Border Grid.ColumnSpan="2" Name="Border"
|
||||||
PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}">
|
BorderBrush="{StaticResource ComboBoxNormalBorderBrush}"
|
||||||
<theme:SystemDropShadowChrome x:Name="shadow"
|
CornerRadius="0" BorderThickness="1, 1, 1, 1"
|
||||||
Color="Transparent"
|
Background="{StaticResource ComboBoxNormalBackgroundBrush}" />
|
||||||
MaxHeight="{TemplateBinding MaxDropDownHeight}"
|
<Border Grid.Column="1" Margin="1, 1, 1, 1" BorderBrush="#444" Name="ButtonBorder"
|
||||||
MinWidth="{Binding ActualWidth, ElementName=templateRoot}">
|
CornerRadius="0, 0, 0, 0" BorderThickness="0, 0, 0, 0"
|
||||||
<Border x:Name="DropDownBorder"
|
Background="{StaticResource ComboBoxNormalBackgroundBrush}" />
|
||||||
BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}"
|
|
||||||
Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"
|
<Path Name="Arrow" Grid.Column="1"
|
||||||
BorderThickness="1">
|
Data="M0,0 L0,2 L4,6 L8,2 L8,0 L4,4 z"
|
||||||
<ScrollViewer x:Name="DropDownScrollViewer">
|
HorizontalAlignment="Center" Fill="#444"
|
||||||
<Grid x:Name="grid" RenderOptions.ClearTypeHint="Enabled">
|
VerticalAlignment="Center" />
|
||||||
<Canvas x:Name="canvas"
|
</Grid>
|
||||||
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>
|
|
||||||
<ControlTemplate.Triggers>
|
<ControlTemplate.Triggers>
|
||||||
<Trigger Property="HasDropShadow" SourceName="PART_Popup" Value="true">
|
<Trigger Property="UIElement.IsMouseOver" Value="True">
|
||||||
<Setter Property="Margin" TargetName="shadow" Value="5"/>
|
<Setter Property="Panel.Background" TargetName="ButtonBorder" Value="WhiteSmoke"/>
|
||||||
<Setter Property="Color" TargetName="shadow" Value="#71000000"/>
|
|
||||||
</Trigger>
|
</Trigger>
|
||||||
<Trigger Property="HasItems" Value="false">
|
<Trigger Property="ToggleButton.IsChecked" Value="True">
|
||||||
<Setter Property="Height" TargetName="DropDownBorder" Value="95"/>
|
<Setter Property="Panel.Background" TargetName="ButtonBorder" Value="WhiteSmoke"/>
|
||||||
|
<Setter Property="Shape.Fill" TargetName="Arrow" Value="#FF8D979E"/>
|
||||||
</Trigger>
|
</Trigger>
|
||||||
<Trigger Property="IsMouseOver" Value="true">
|
<Trigger Property="UIElement.IsEnabled" Value="False">
|
||||||
<Setter Property="BorderBrush" Value="#FA6EC9"/>
|
<Setter Property="Panel.Background" TargetName="Border" Value="{StaticResource ComboBoxDisabledBackgroundBrush}"/>
|
||||||
</Trigger>
|
<Setter Property="Panel.Background" TargetName="ButtonBorder" Value="{StaticResource ComboBoxDisabledBackgroundBrush}"/>
|
||||||
<MultiTrigger>
|
<Setter Property="Border.BorderBrush" TargetName="ButtonBorder" Value="{StaticResource ComboBoxDisabledBorderBrush}"/>
|
||||||
<MultiTrigger.Conditions>
|
<Setter Property="TextElement.Foreground" Value="{StaticResource ComboBoxDisabledForegroundBrush}"/>
|
||||||
<Condition Property="IsGrouping" Value="true" />
|
<Setter Property="Shape.Fill" TargetName="Arrow" Value="#999"/>
|
||||||
<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>
|
</Trigger>
|
||||||
</ControlTemplate.Triggers>
|
</ControlTemplate.Triggers>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
|
|
||||||
<Style x:Key="ZuneComboBoxStyle" TargetType="{x:Type ComboBox}">
|
<Style x:Key="ZuneComboBoxStyle" TargetType="{x:Type ComboBox}">
|
||||||
<!--<Setter Property="FocusVisualStyle" Value="{StaticResource Ý}"/>-->
|
<Setter Property="UIElement.SnapsToDevicePixels" Value="True"/>
|
||||||
<Setter Property="Background" Value="{StaticResource NormalComboBoxBackgroundBrush}"/>
|
<Setter Property="FrameworkElement.OverridesDefaultStyle" Value="True"/>
|
||||||
<Setter Property="Foreground" Value="#606060"/>
|
|
||||||
<Setter Property="TextElement.FontWeight" Value="SemiBold"/>
|
|
||||||
<Setter Property="BorderThickness" Value="1" />
|
|
||||||
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
|
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
|
||||||
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" 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.CanContentScroll" Value="true"/>
|
<Setter Property="TextElement.Foreground" Value="Black"/>
|
||||||
<Setter Property="ScrollViewer.PanningMode" Value="Both"/>
|
<Setter Property="FrameworkElement.FocusVisualStyle" Value="{x:Null}"/>
|
||||||
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
|
<Setter Property="Control.Template">
|
||||||
<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.Value>
|
<Setter.Value>
|
||||||
<ControlTemplate TargetType="{x:Type ComboBoxItem}">
|
<ControlTemplate TargetType="ComboBox">
|
||||||
<Border x:Name="Bd"
|
<Grid>
|
||||||
BorderBrush="{TemplateBinding BorderBrush}"
|
<ToggleButton Name="ToggleButton" Grid.Column="2"
|
||||||
BorderThickness="{TemplateBinding BorderThickness}"
|
ClickMode="Press" Focusable="False"
|
||||||
Background="{TemplateBinding Background}"
|
IsChecked="{Binding Path=IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
|
||||||
Padding="{TemplateBinding Padding}"
|
Template="{StaticResource ZuneComboBoxToggleButton}"/>
|
||||||
SnapsToDevicePixels="true">
|
|
||||||
<ContentPresenter
|
<ContentPresenter Name="ContentSite" Margin="5, 3, 23, 3" IsHitTestVisible="False"
|
||||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
HorizontalAlignment="Left" VerticalAlignment="Center"
|
||||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
Content="{TemplateBinding ComboBox.SelectionBoxItem}"
|
||||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
ContentTemplate="{TemplateBinding ComboBox.SelectionBoxItemTemplate}"
|
||||||
</Border>
|
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>
|
<ControlTemplate.Triggers>
|
||||||
<Trigger Property="IsEnabled" Value="False">
|
<Trigger Property="ItemsControl.HasItems" Value="False">
|
||||||
<Setter TargetName="Bd" Property="TextElement.Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
|
<Setter Property="FrameworkElement.MinHeight" TargetName="DropDownBorder" Value="95"/>
|
||||||
</Trigger>
|
</Trigger>
|
||||||
<Trigger Property="IsEnabled" Value="True">
|
<Trigger Property="UIElement.IsEnabled" Value="False">
|
||||||
<Setter TargetName="Bd" Property="TextElement.Foreground" Value="#3D4042" />
|
<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>
|
</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.Triggers>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Setter.Value>
|
</Setter.Value>
|
||||||
</Setter>
|
</Setter>
|
||||||
</Style>
|
</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>
|
</ResourceDictionary>
|
||||||
Reference in New Issue
Block a user