Skip to content

Commit

Permalink
Improve styling
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyrrrz committed Apr 23, 2024
1 parent e8a92ca commit d1d9db2
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 20 deletions.
31 changes: 22 additions & 9 deletions LightBulb/App.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,7 @@

<!-- Text box -->
<Style Selector="TextBox">
<Setter Property="Height" Value="22" />
<Setter Property="FontSize" Value="14" />

<Style Selector="^ /template/ Panel#PART_TextFieldPanel">
<Setter Property="MinHeight" Value="0" />
</Style>

<Style Selector="^ /template/ Panel#PART_TextContainer">
<Setter Property="Margin" Value="0" />
</Style>
</Style>

<!-- Toggle button -->
Expand All @@ -103,6 +94,28 @@
</Style>
</Application.Styles>

<Application.Resources>
<!-- Text box -->
<ControlTheme
x:Key="CompactTextBox"
BasedOn="{StaticResource {x:Type TextBox}}"
TargetType="{x:Type TextBox}">
<Styles>
<Style Selector="TextBox">
<Setter Property="Height" Value="22" />

<Style Selector="^ /template/ Panel#PART_TextFieldPanel">
<Setter Property="MinHeight" Value="0" />
</Style>

<Style Selector="^ /template/ Panel#PART_TextContainer">
<Setter Property="Margin" Value="0" />
</Style>
</Style>
</Styles>
</ControlTheme>
</Application.Resources>

<!-- Tray icon -->
<TrayIcon.Icons>
<TrayIcons>
Expand Down
18 changes: 12 additions & 6 deletions LightBulb/Views/Components/Settings/GeneralSettingsTabView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
<TextBox
MinWidth="24"
HorizontalAlignment="Right"
DockPanel.Dock="Right">
DockPanel.Dock="Right"
Theme="{DynamicResource CompactTextBox}">
<Interaction.Behaviors>
<behaviors:LostFocusUpdateBindingBehavior Text="{Binding DayTemperature, Converter={x:Static converters:DoubleToStringConverter.Instance}}" />
</Interaction.Behaviors>
Expand All @@ -38,7 +39,8 @@
<TextBox
MinWidth="24"
HorizontalAlignment="Right"
DockPanel.Dock="Right">
DockPanel.Dock="Right"
Theme="{DynamicResource CompactTextBox}">
<Interaction.Behaviors>
<behaviors:LostFocusUpdateBindingBehavior Text="{Binding NightTemperature, Converter={x:Static converters:DoubleToStringConverter.Instance}}" />
</Interaction.Behaviors>
Expand Down Expand Up @@ -73,7 +75,8 @@
<TextBox
MinWidth="24"
HorizontalAlignment="Right"
DockPanel.Dock="Right">
DockPanel.Dock="Right"
Theme="{DynamicResource CompactTextBox}">
<Interaction.Behaviors>
<behaviors:LostFocusUpdateBindingBehavior Text="{Binding DayBrightness, Converter={x:Static converters:FractionToPercentageStringConverter.Instance}}" />
</Interaction.Behaviors>
Expand Down Expand Up @@ -108,7 +111,8 @@
<TextBox
MinWidth="24"
HorizontalAlignment="Right"
DockPanel.Dock="Right">
DockPanel.Dock="Right"
Theme="{DynamicResource CompactTextBox}">
<Interaction.Behaviors>
<behaviors:LostFocusUpdateBindingBehavior Text="{Binding NightBrightness, Converter={x:Static converters:FractionToPercentageStringConverter.Instance}}" />
</Interaction.Behaviors>
Expand All @@ -130,7 +134,8 @@
<TextBox
MinWidth="48"
HorizontalAlignment="Right"
DockPanel.Dock="Right">
DockPanel.Dock="Right"
Theme="{DynamicResource CompactTextBox}">
<Interaction.Behaviors>
<behaviors:LostFocusUpdateBindingBehavior Text="{Binding ConfigurationTransitionDuration, Converter={x:Static converters:TimeSpanToDurationStringConverter.Instance}}" />
</Interaction.Behaviors>
Expand All @@ -150,7 +155,8 @@
<TextBox
MinWidth="24"
HorizontalAlignment="Right"
DockPanel.Dock="Right">
DockPanel.Dock="Right"
Theme="{DynamicResource CompactTextBox}">
<Interaction.Behaviors>
<behaviors:LostFocusUpdateBindingBehavior Text="{Binding ConfigurationTransitionOffset, Converter={x:Static converters:FractionToPercentageStringConverter.Instance}}" />
</Interaction.Behaviors>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
<TextBox
MinWidth="24"
HorizontalAlignment="Right"
DockPanel.Dock="Right">
DockPanel.Dock="Right"
Theme="{DynamicResource CompactTextBox}">
<Interaction.Behaviors>
<behaviors:LostFocusUpdateBindingBehavior Text="{Binding ManualSunrise, Converter={x:Static converters:TimeOnlyToStringConverter.Instance}}" />
</Interaction.Behaviors>
Expand All @@ -58,7 +59,8 @@
<TextBox
MinWidth="24"
HorizontalAlignment="Right"
DockPanel.Dock="Right">
DockPanel.Dock="Right"
Theme="{DynamicResource CompactTextBox}">
<Interaction.Behaviors>
<behaviors:LostFocusUpdateBindingBehavior Text="{Binding ManualSunset, Converter={x:Static converters:TimeOnlyToStringConverter.Instance}}" />
</Interaction.Behaviors>
Expand Down Expand Up @@ -101,7 +103,8 @@
Margin="8,0"
VerticalAlignment="Center"
IsEnabled="{Binding !IsBusy}"
Text="{Binding LocationQuery}">
Text="{Binding LocationQuery}"
Theme="{DynamicResource CompactTextBox}">
<ToolTip.Tip>
<TextBlock>
<Run Text="Specify your location using geographic coordinates or a search query" />
Expand Down
3 changes: 2 additions & 1 deletion LightBulb/Views/Controls/HotKeyTextBox.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
IsReadOnly="True"
IsUndoEnabled="False"
Text="{Binding $parent[UserControl].HotKey, Mode=OneWay}"
TextAlignment="Center" />
TextAlignment="Center"
Theme="{DynamicResource CompactTextBox}" />
</UserControl>
3 changes: 2 additions & 1 deletion LightBulb/Views/Dialogs/MessageBoxView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
Columns="{Binding ButtonsCount}">
<!-- OK -->
<Button
Margin="8,0"
Command="{Binding CloseCommand}"
Content="{Binding DefaultButtonText}"
IsDefault="True"
Expand All @@ -53,7 +54,7 @@

<!-- Cancel -->
<Button
Margin="16,0,0,0"
Margin="8,0"
HorizontalAlignment="Stretch"
Command="{Binding CloseCommand}"
Content="{Binding CancelButtonText}"
Expand Down
1 change: 1 addition & 0 deletions LightBulb/Views/MainView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
Closing="Window_OnClosing"
Icon="/favicon.ico"
Loaded="Window_OnLoaded"
RenderOptions.BitmapInterpolationMode="HighQuality"
SystemDecorations="None"
WindowStartupLocation="CenterScreen">
<Design.DataContext>
Expand Down

0 comments on commit d1d9db2

Please sign in to comment.