Skip to content

Commit

Permalink
Resource cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
dotMorten committed Nov 16, 2024
1 parent 51cb8e0 commit 3e8694f
Show file tree
Hide file tree
Showing 15 changed files with 242 additions and 298 deletions.
1 change: 0 additions & 1 deletion GeneratedResources/WPF/Colors/Brushes.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,4 @@
<SolidColorBrush x:Key="CalciteUIDangerBrush" Color="{DynamicResource CalciteUIDangerColor}" />
<SolidColorBrush x:Key="CalciteUIDangerHoverBrush" Color="{DynamicResource CalciteUIDangerHoverColor}" />
<SolidColorBrush x:Key="CalciteUIDangerPressBrush" Color="{DynamicResource CalciteUIDangerPressColor}" />
<SolidColorBrush x:Key="CalciteUIForegroundBrandContrastBrush" Color="White" />
</ResourceDictionary>
1 change: 0 additions & 1 deletion src/Esri.Calcite.WinUI/CalciteResources.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
<ResourceDictionary Source="ms-appx:///Esri.Calcite.WinUI/Colors/Colors.xaml" />
<ResourceDictionary Source="ms-appx:///Esri.Calcite.WinUI/Colors/Brushes.xaml" />
<ResourceDictionary Source="ms-appx:///Esri.Calcite.WinUI/Styles/Brushes.xaml" />
<ResourceDictionary Source="ms-appx:///Esri.Calcite.WinUI/Styles/Sizes.xaml" />
<ResourceDictionary Source="ms-appx:///Esri.Calcite.WinUI/Styles/Fonts.xaml" />
<ResourceDictionary Source="ms-appx:///Esri.Calcite.WinUI/Icons/Glyphs.xaml" />
<ResourceDictionary Source="ms-appx:///Esri.Calcite.WinUI/Styles/Controls/Controls.xaml" />
Expand Down
5 changes: 3 additions & 2 deletions src/Esri.Calcite.WinUI/Styles/Controls/Buttons.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ms-appx:///Esri.Calcite.WinUI/Styles/Fonts.xaml" />
<ResourceDictionary Source="ms-appx:///Esri.Calcite.WinUI/Styles/Sizes.xaml" />
<ResourceDictionary Source="ms-appx:///Esri.Calcite.WinUI/Styles/Brushes.xaml" />
</ResourceDictionary.MergedDictionaries>

Expand All @@ -21,14 +20,16 @@
<StaticResource x:Key="ButtonBorderBrushPointerOver" ResourceKey="CalciteUIBrandHoverBrush" />
<StaticResource x:Key="ButtonBorderBrushPressed" ResourceKey="CalciteUIBrandPressBrush" />
<!--<StaticResource x:Key="ButtonBorderBrushDisabled" ResourceKey="SystemControlDisabledTransparentBrush" />-->
<!-- Button padding should take button border offset into account (e.g. +1 to get desired effect of 8,4,8,4) -->
<Thickness x:Key="CalciteButtonPadding">7,3,7,3</Thickness>


<Style TargetType="Button" x:Key="CalciteButtonStyle" BasedOn="{StaticResource DefaultButtonStyle}">
<Setter Property="BorderThickness" Value="1" />
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Padding" Value="{StaticResource ButtonPadding}" />
<Setter Property="Padding" Value="{StaticResource CalciteButtonPadding}" />
<Setter Property="MinHeight" Value="28" />
<Setter Property="CornerRadius" Value="0" />
<Setter Property="cal:CalciteResources.StyleResources">
Expand Down
26 changes: 0 additions & 26 deletions src/Esri.Calcite.WinUI/Styles/Sizes.xaml

This file was deleted.

3 changes: 3 additions & 0 deletions src/Esri.Calcite.Wpf/ControlOverrides.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
</ResourceDictionary.MergedDictionaries>
<!-- Overrides the default styling of controls -->
<Style BasedOn="{StaticResource CalciteTreeViewStyle}" TargetType="TreeView" />
<Style BasedOn="{StaticResource CalciteTreeViewItem}" TargetType="TreeViewItem" />
<Style BasedOn="{StaticResource CalciteTextBoxStyle}" TargetType="TextBox" />
<Style BasedOn="{StaticResource CalcitePasswordBoxStyle}" TargetType="PasswordBox" />
<Style BasedOn="{StaticResource CalciteTabStyle}" TargetType="TabControl" />
Expand Down Expand Up @@ -39,4 +40,6 @@
<Style BasedOn="{StaticResource CalciteListBoxStyle}" TargetType="ListBox" />
<Style BasedOn="{StaticResource CalciteScrollBarStyle}" TargetType="{x:Type ScrollBar}"/>
<Style BasedOn="{StaticResource CalciteScrollViewerStyle}" TargetType="{x:Type ScrollViewer}"/>
<Style BasedOn="{StaticResource CalciteComboboxItem}" TargetType="{x:Type ComboBoxItem}" />
<Style BasedOn="{StaticResource CalciteToolbarTray}" TargetType="{x:Type ToolBarTray}" />
</ResourceDictionary>
154 changes: 81 additions & 73 deletions src/Esri.Calcite.Wpf/Controls/Buttons.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,92 +8,100 @@
<ResourceDictionary Source="..\Shared\Fonts.xaml" />
<ResourceDictionary Source="..\Shared\Sizes.xaml" />
</ResourceDictionary.MergedDictionaries>
<ControlTemplate x:Key="CalciteBaseButtonTemplate" TargetType="ButtonBase">
<Border
x:Name="bg"
Padding="{StaticResource ButtonBorderOffset}"
Background="{Binding Path=(ca:AttachedBrushes.BackgroundNormal), RelativeSource={RelativeSource Mode=Self}}"
BorderBrush="{Binding Path=(ca:AttachedBrushes.BorderNormal), RelativeSource={RelativeSource Mode=Self}}"
BorderThickness="{StaticResource ButtonBorderThickness}"
Cursor="{DynamicResource CalciteActionCursor}">
<Grid>
<Grid
Margin="{StaticResource ButtonPadding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Path
x:Name="PART_Icon"
VerticalAlignment="Center"
Data="{Binding RelativeSource={RelativeSource Mode=Self}, Path=(ca:Calcite.Icon)}"
Fill="{TemplateBinding Foreground}" />
<ContentPresenter
x:Name="content"
Grid.Column="1"
Margin="{StaticResource ButtonPadding}"
VerticalAlignment="Center"
Content="{TemplateBinding Content}"
TextBlock.Foreground="{TemplateBinding Foreground}" />
</Grid>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="ca:Calcite.Icon" Value="{x:Null}">
<Setter TargetName="PART_Icon" Property="Visibility" Value="Collapsed" />
</Trigger>
<Trigger Property="Content" Value="{x:Null}">
<Setter TargetName="content" Property="Visibility" Value="Collapsed" />
</Trigger>
<Trigger Property="Content" Value="">
<Setter TargetName="content" Property="Visibility" Value="Collapsed" />
</Trigger>
<Trigger Property="IsMouseOver" Value="False">
<Setter Property="Foreground" Value="{Binding Path=(ca:AttachedBrushes.ForegroundNormal), RelativeSource={RelativeSource Self}}" />
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="bg" Property="BorderBrush" Value="{Binding Path=(ca:AttachedBrushes.BorderHover), RelativeSource={RelativeSource Self}}" />
<Setter TargetName="bg" Property="Background" Value="{Binding Path=(ca:AttachedBrushes.BackgroundHover), RelativeSource={RelativeSource Self}}" />
<Setter Property="Foreground" Value="{Binding Path=(ca:AttachedBrushes.ForegroundHover), RelativeSource={RelativeSource Self}}" />
<Setter TargetName="bg" Property="BorderThickness" Value="2" />
<Setter TargetName="bg" Property="Padding" Value="0" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="bg" Property="BorderBrush" Value="{Binding Path=(ca:AttachedBrushes.BorderPress), RelativeSource={RelativeSource Self}}" />
<Setter TargetName="bg" Property="Background" Value="{Binding Path=(ca:AttachedBrushes.BackgroundPress), RelativeSource={RelativeSource Self}}" />
<Setter Property="Foreground" Value="{Binding Path=(ca:AttachedBrushes.ForegroundPress), RelativeSource={RelativeSource Self}}" />
<Setter TargetName="bg" Property="BorderThickness" Value="2" />
<Setter TargetName="bg" Property="Padding" Value="0" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="bg" Property="Opacity" Value="0.8" />
</Trigger>
<Trigger Property="IsEnabled" Value="True">
<Setter TargetName="bg" Property="Opacity" Value="1" />
</Trigger>
<Trigger Property="ToggleButton.IsChecked" Value="True">
<Setter TargetName="bg" Property="Background" Value="{Binding Path=(ca:AttachedBrushes.BackgroundPress), RelativeSource={RelativeSource Self}}" />
<Setter Property="Foreground" Value="{Binding Path=(ca:AttachedBrushes.ForegroundPress), RelativeSource={RelativeSource Self}}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>

<!-- Button padding should take button border offset into account (e.g. +1 to get desired effect of 8,4,8,4) -->
<Thickness x:Key="CalciteButtonPadding">7,0,7,0</Thickness>

<Style x:Key="InternalButtonBaseStyle" TargetType="ButtonBase">
<Setter Property="BorderThickness" Value="1" />
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Padding" Value="{StaticResource ButtonPadding}" />
<Setter Property="Padding" Value="{StaticResource CalciteButtonPadding}" />
<Setter Property="MinHeight" Value="28" />
<Setter Property="Cursor" Value="{DynamicResource CalciteActionCursor}" />
<Setter Property="Template" Value="{StaticResource CalciteBaseButtonTemplate}" />
<Setter Property="Template" >
<Setter.Value>
<ControlTemplate TargetType="ButtonBase">
<Border
x:Name="bg"
Padding="1"
Background="{Binding Path=(ca:AttachedBrushes.BackgroundNormal), RelativeSource={RelativeSource Mode=Self}}"
BorderBrush="{Binding Path=(ca:AttachedBrushes.BorderNormal), RelativeSource={RelativeSource Mode=Self}}"
BorderThickness="1"
Cursor="{DynamicResource CalciteActionCursor}">
<Grid>
<Grid
Margin="{StaticResource CalciteButtonPadding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Path
x:Name="PART_Icon"
VerticalAlignment="Center"
Data="{Binding RelativeSource={RelativeSource Mode=Self}, Path=(ca:Calcite.Icon)}"
Fill="{TemplateBinding Foreground}" />
<ContentPresenter
x:Name="content"
Grid.Column="1"
Margin="{StaticResource CalciteButtonPadding}"
VerticalAlignment="Center"
Content="{TemplateBinding Content}"
TextBlock.Foreground="{TemplateBinding Foreground}" />
</Grid>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="ca:Calcite.Icon" Value="{x:Null}">
<Setter TargetName="PART_Icon" Property="Visibility" Value="Collapsed" />
</Trigger>
<Trigger Property="Content" Value="{x:Null}">
<Setter TargetName="content" Property="Visibility" Value="Collapsed" />
</Trigger>
<Trigger Property="Content" Value="">
<Setter TargetName="content" Property="Visibility" Value="Collapsed" />
</Trigger>
<Trigger Property="IsMouseOver" Value="False">
<Setter Property="Foreground" Value="{Binding Path=(ca:AttachedBrushes.ForegroundNormal), RelativeSource={RelativeSource Self}}" />
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="bg" Property="BorderBrush" Value="{Binding Path=(ca:AttachedBrushes.BorderHover), RelativeSource={RelativeSource Self}}" />
<Setter TargetName="bg" Property="Background" Value="{Binding Path=(ca:AttachedBrushes.BackgroundHover), RelativeSource={RelativeSource Self}}" />
<Setter Property="Foreground" Value="{Binding Path=(ca:AttachedBrushes.ForegroundHover), RelativeSource={RelativeSource Self}}" />
<Setter TargetName="bg" Property="BorderThickness" Value="2" />
<Setter TargetName="bg" Property="Padding" Value="0" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="bg" Property="BorderBrush" Value="{Binding Path=(ca:AttachedBrushes.BorderPress), RelativeSource={RelativeSource Self}}" />
<Setter TargetName="bg" Property="Background" Value="{Binding Path=(ca:AttachedBrushes.BackgroundPress), RelativeSource={RelativeSource Self}}" />
<Setter Property="Foreground" Value="{Binding Path=(ca:AttachedBrushes.ForegroundPress), RelativeSource={RelativeSource Self}}" />
<Setter TargetName="bg" Property="BorderThickness" Value="2" />
<Setter TargetName="bg" Property="Padding" Value="0" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="bg" Property="Opacity" Value="0.8" />
</Trigger>
<Trigger Property="IsEnabled" Value="True">
<Setter TargetName="bg" Property="Opacity" Value="1" />
</Trigger>
<Trigger Property="ToggleButton.IsChecked" Value="True">
<Setter TargetName="bg" Property="Background" Value="{Binding Path=(ca:AttachedBrushes.BackgroundPress), RelativeSource={RelativeSource Self}}" />
<Setter Property="Foreground" Value="{Binding Path=(ca:AttachedBrushes.ForegroundPress), RelativeSource={RelativeSource Self}}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="ca:AttachedFormData.IsInForm" Value="True">
<Setter Property="Margin" Value="{DynamicResource FormChildMargin}" />
</Trigger>
</Style.Triggers>
</Style>

<Style
x:Key="CalcitePrimaryButtonBaseStyle"
BasedOn="{StaticResource InternalButtonBaseStyle}"
Expand Down
Loading

0 comments on commit 3e8694f

Please sign in to comment.