Skip to content

Commit

Permalink
Merge remote-tracking branch 'mntone/add-textbox-theme' into develop
Browse files Browse the repository at this point in the history
Import PR Grabacr07#48
  • Loading branch information
nishy2000 committed Sep 19, 2020
2 parents 60de5db + 694aaee commit 7190c59
Show file tree
Hide file tree
Showing 4 changed files with 135 additions and 52 deletions.
31 changes: 17 additions & 14 deletions samples/MetroRadiance.Showcase/UI/ControlSamples.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,12 @@
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Text="metro:PromptTextBox: "/>
<metro:PromptTextBox Grid.Row="0" Grid.Column="1" Margin="5">
<TextBlock Grid.Row="0" Grid.Column="0" Text="TextBox: "/>
<TextBox Grid.Row="0" Grid.Column="1" Margin="5" Text="TextBox" />
<TextBlock Grid.Row="1" Grid.Column="0" Text="metro:PromptTextBox: "/>
<metro:PromptTextBox Grid.Row="1" Grid.Column="1" Margin="5">
<metro:PromptTextBox.Text>
<Binding Path="Int32"
UpdateSourceTrigger="PropertyChanged">
Expand All @@ -58,8 +61,8 @@
</Binding>
</metro:PromptTextBox.Text>
</metro:PromptTextBox>
<TextBlock Grid.Row="1" Grid.Column="0" Text="metro:PromptComboBox: "/>
<metro:PromptComboBox Grid.Row="1" Grid.Column="1"
<TextBlock Grid.Row="2" Grid.Column="0" Text="metro:PromptComboBox: "/>
<metro:PromptComboBox Grid.Row="2" Grid.Column="1"
Margin="5"
IsEditable="True">
<metro:PromptComboBox.Text>
Expand All @@ -72,26 +75,26 @@
</Binding>
</metro:PromptComboBox.Text>
</metro:PromptComboBox>
<TextBlock Grid.Row="2" Grid.Column="0" Text="PasswordBox: "/>
<PasswordBox Grid.Row="2" Grid.Column="1"
<TextBlock Grid.Row="3" Grid.Column="0" Text="PasswordBox: "/>
<PasswordBox Grid.Row="3" Grid.Column="1"
Margin="5" />
<TextBlock Grid.Row="3" Grid.Column="0" Text="CheckBox: "/>
<CheckBox Grid.Row="3" Grid.Column="1" Content="{x:Static prop:Resources.ControlSample_TextCheckBox}"
<TextBlock Grid.Row="4" Grid.Column="0" Text="CheckBox: "/>
<CheckBox Grid.Row="4" Grid.Column="1" Content="{x:Static prop:Resources.ControlSample_TextCheckBox}"
Margin="4" />
<TextBlock Grid.Row="4" Grid.Column="0" Text="RadioButton: "/>
<StackPanel Grid.Row="4" Grid.Column="1" Orientation="Vertical">
<TextBlock Grid.Row="5" Grid.Column="0" Text="RadioButton: "/>
<StackPanel Grid.Row="5" Grid.Column="1" Orientation="Vertical">
<RadioButton Content="{x:Static prop:Resources.ControlSample_TextRadioButtonItem1}"
Margin="4" />
<RadioButton Content="{x:Static prop:Resources.ControlSample_TextRadioButtonItem2}"
Margin="4" />
<RadioButton Content="{x:Static prop:Resources.ControlSample_TextRadioButtonItem3}"
Margin="4" />
</StackPanel>
<TextBlock Grid.Row="5" Grid.Column="0" Text="ToggleButton: "/>
<ToggleButton Grid.Row="5" Grid.Column="1" Content="{x:Static prop:Resources.ControlSample_TextToggleButton}"
<TextBlock Grid.Row="6" Grid.Column="0" Text="ToggleButton: "/>
<ToggleButton Grid.Row="6" Grid.Column="1" Content="{x:Static prop:Resources.ControlSample_TextToggleButton}"
Margin="4" />
<TextBlock Grid.Row="6" Grid.Column="0" Text="Tooltip: "/>
<Border Grid.Row="6" Grid.Column="1"
<TextBlock Grid.Row="7" Grid.Column="0" Text="Tooltip: "/>
<Border Grid.Row="7" Grid.Column="1"
Margin="4"
BorderThickness="1"
BorderBrush="{DynamicResource BorderBrushKey}">
Expand Down
81 changes: 43 additions & 38 deletions source/MetroRadiance/Styles/Controls.PasswordBox.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,55 +12,60 @@
Value=".99" />
<Setter Property="Padding"
Value="1" />
<Setter Property="VerticalContentAlignment"
Value="Center" />
<Setter Property="KeyboardNavigation.TabNavigation"
Value="None" />
<Setter Property="HorizontalContentAlignment"
Value="Left" />
<Setter Property="FocusVisualStyle"
Value="{DynamicResource {x:Static SystemParameters.FocusVisualStyleKey}}" />
Value="{x:Null}" />
<Setter Property="AllowDrop"
Value="True" />
<Setter Property="ScrollViewer.PanningMode"
Value="VerticalFirst" />
<Setter Property="Stylus.IsFlicksEnabled"
Value="False" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type PasswordBox}">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
<Grid>
<ScrollViewer x:Name="PART_ContentHost"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Margin="{TemplateBinding Padding}"
Background="Transparent" />
</Grid>
SnapsToDevicePixels="True">
<ScrollViewer x:Name="PART_ContentHost"
Margin="{TemplateBinding Padding}"
Focusable="False"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver"
Value="True">
<Setter Property="Background"
Value="{DynamicResource ActiveBackgroundBrushKey}" />
<Setter Property="BorderBrush"
Value="{DynamicResource ActiveBorderBrushKey}" />
</Trigger>
<Trigger Property="IsKeyboardFocused"
Value="True">
<Setter Property="Background"
Value="{DynamicResource ActiveBackgroundBrushKey}" />
<Setter Property="BorderBrush"
Value="{DynamicResource ActiveBorderBrushKey}" />
</Trigger>
<Trigger Property="IsEnabled"
Value="False">
<Setter Property="Background"
Value="{DynamicResource InactiveBackgroundBrushKey}" />
<Setter Property="BorderBrush"
Value="{DynamicResource InactiveBorderBrushKey}" />
<Setter Property="Foreground"
Value="{DynamicResource InactiveForegroundBrushKey}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver"
Value="True">
<Setter Property="Background"
Value="{DynamicResource ActiveBackgroundBrushKey}" />
<Setter Property="BorderBrush"
Value="{DynamicResource ActiveBorderBrushKey}" />
</Trigger>

<Trigger Property="IsKeyboardFocusWithin"
Value="True">
<Setter Property="Background"
Value="{DynamicResource ActiveBackgroundBrushKey}" />
<Setter Property="BorderBrush"
Value="{DynamicResource ActiveBorderBrushKey}" />
</Trigger>

<Trigger Property="IsEnabled"
Value="False">
<Setter Property="Background"
Value="{DynamicResource InactiveBackgroundBrushKey}" />
<Setter Property="BorderBrush"
Value="{DynamicResource InactiveBorderBrushKey}" />
<Setter Property="Foreground"
Value="{DynamicResource InactiveForegroundBrushKey}" />
</Trigger>
</Style.Triggers>
</Style>

</ResourceDictionary>
74 changes: 74 additions & 0 deletions source/MetroRadiance/Styles/Controls.TextBox.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

<Style TargetType="{x:Type TextBoxBase}">
<Setter Property="Background"
Value="{DynamicResource SemiactiveBackgroundBrushKey}" />
<Setter Property="BorderBrush"
Value="{DynamicResource SemiactiveBorderBrushKey}" />
<Setter Property="Foreground"
Value="{DynamicResource ActiveForegroundBrushKey}" />
<Setter Property="BorderThickness"
Value=".99" />
<Setter Property="Padding"
Value="1" />
<Setter Property="KeyboardNavigation.TabNavigation"
Value="None" />
<Setter Property="HorizontalContentAlignment"
Value="Left" />
<Setter Property="FocusVisualStyle"
Value="{x:Null}" />
<Setter Property="AllowDrop"
Value="True" />
<Setter Property="ScrollViewer.PanningMode"
Value="VerticalFirst" />
<Setter Property="Stylus.IsFlicksEnabled"
Value="False" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TextBoxBase}">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
SnapsToDevicePixels="True">
<ScrollViewer x:Name="PART_ContentHost"
Margin="{TemplateBinding Padding}"
Focusable="False"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver"
Value="True">
<Setter Property="Background"
Value="{DynamicResource ActiveBackgroundBrushKey}" />
<Setter Property="BorderBrush"
Value="{DynamicResource ActiveBorderBrushKey}" />
</Trigger>
<Trigger Property="IsKeyboardFocused"
Value="True">
<Setter Property="Background"
Value="{DynamicResource ActiveBackgroundBrushKey}" />
<Setter Property="BorderBrush"
Value="{DynamicResource ActiveBorderBrushKey}" />
</Trigger>
<Trigger Property="IsEnabled"
Value="False">
<Setter Property="Background"
Value="{DynamicResource InactiveBackgroundBrushKey}" />
<Setter Property="BorderBrush"
Value="{DynamicResource InactiveBorderBrushKey}" />
<Setter Property="Foreground"
Value="{DynamicResource InactiveForegroundBrushKey}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style TargetType="{x:Type TextBox}"
BasedOn="{StaticResource {x:Type TextBoxBase}}" />

</ResourceDictionary>
1 change: 1 addition & 0 deletions source/MetroRadiance/Styles/Controls.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<ResourceDictionary Source="pack://application:,,,/MetroRadiance;component/Styles/Controls.PasswordBox.xaml" />
<ResourceDictionary Source="pack://application:,,,/MetroRadiance;component/Styles/Controls.RadioButton.xaml" />
<ResourceDictionary Source="pack://application:,,,/MetroRadiance;component/Styles/Controls.Scrollbar.xaml" />
<ResourceDictionary Source="pack://application:,,,/MetroRadiance;component/Styles/Controls.TextBox.xaml" />
<ResourceDictionary Source="pack://application:,,,/MetroRadiance;component/Styles/Controls.Tooltip.xaml" />
</ResourceDictionary.MergedDictionaries>

Expand Down

0 comments on commit 7190c59

Please sign in to comment.