fix: update ComboBox popup behavior and style when scrollbar is visible (#865)

This commit is contained in:
Jeffrey
2026-10-25 02:05:35 +01:00
committed by GitHub
parent 2a03c7a5d5
commit 74648cbe26
+47 -39
View File
@@ -244,6 +244,45 @@
<Setter Property="Margin" Value="0,0,0,8"/>
</Style>
<!-- ScrollBar Style -->
<Style x:Key="AppScrollBarStyle" TargetType="{x:Type ScrollBar}">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Width" Value="8"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ScrollBar}">
<Grid>
<Track Name="PART_Track" IsDirectionReversed="true">
<Track.Thumb>
<Thumb>
<Thumb.Style>
<Style TargetType="Thumb">
<Setter Property="Background" Value="{DynamicResource ScrollBarThumbColor}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Thumb">
<Border Background="{TemplateBinding Background}" CornerRadius="4"/>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{DynamicResource ScrollBarThumbHoverColor}"/>
</Trigger>
</Style.Triggers>
</Style>
</Thumb.Style>
</Thumb>
</Track.Thumb>
</Track>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type ScrollBar}" BasedOn="{StaticResource AppScrollBarStyle}"/>
<!-- Shared ComboBox style used across windows -->
<Style TargetType="ComboBoxItem">
<Setter Property="Foreground" Value="{DynamicResource AppFgColor}"/>
@@ -365,13 +404,13 @@
Content="{TemplateBinding SelectionBoxItem}"
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"/>
<Popup x:Name="Popup"
<Popup x:Name="PART_Popup"
Placement="Bottom"
IsOpen="{TemplateBinding IsDropDownOpen}"
AllowsTransparency="True"
Focusable="False"
PopupAnimation="Fade"
StaysOpen="False"
StaysOpen="True"
PlacementTarget="{Binding ElementName=ToggleButton}"
VerticalOffset="1"
HorizontalOffset="0">
@@ -386,8 +425,14 @@
<DropShadowEffect BlurRadius="12" Opacity="0.25" ShadowDepth="4"/>
</Border.Effect>
<ScrollViewer Margin="0,2,0,0"
CanContentScroll="False"
VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Disabled">
<ScrollViewer.Resources>
<Style TargetType="{x:Type ScrollBar}" BasedOn="{StaticResource AppScrollBarStyle}">
<Setter Property="Margin" Value="0,0,0,5"/>
</Style>
</ScrollViewer.Resources>
<ItemsPresenter Margin="0,0,0,1"/>
</ScrollViewer>
</Border>
@@ -553,43 +598,6 @@
<Setter Property="Margin" Value="8,4"/>
</Style>
<!-- ScrollBar Style -->
<Style TargetType="{x:Type ScrollBar}">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Width" Value="8"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ScrollBar}">
<Grid>
<Track Name="PART_Track" IsDirectionReversed="true">
<Track.Thumb>
<Thumb>
<Thumb.Style>
<Style TargetType="Thumb">
<Setter Property="Background" Value="{DynamicResource ScrollBarThumbColor}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Thumb">
<Border Background="{TemplateBinding Background}" CornerRadius="4"/>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{DynamicResource ScrollBarThumbHoverColor}"/>
</Trigger>
</Style.Triggers>
</Style>
</Thumb.Style>
</Thumb>
</Track.Thumb>
</Track>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- TextBox outer border: side/top borders in side color, background with hover/focus states -->
<Style x:Key="TextBoxBorderStyle" TargetType="Border">
<Setter Property="Background" Value="{DynamicResource TextBoxBgColor}"/>