fix: fix popup Padding.

This commit is contained in:
Zhang Dian 2024-12-01 23:34:26 +08:00
parent 266fdade35
commit 50b5159d17
7 changed files with 92 additions and 105 deletions

View File

@ -33,15 +33,13 @@
PlacementTarget="{TemplateBinding}">
<Border
Margin="{DynamicResource AutoCompleteBoxPopupMargin}"
Padding="{DynamicResource AutoCompleteBoxPopupPadding}"
HorizontalAlignment="Stretch"
Background="{DynamicResource AutoCompleteBoxPopupBackground}"
BorderBrush="{DynamicResource AutoCompleteBoxPopupBorderBrush}"
BorderThickness="{DynamicResource AutoCompleteBoxPopupBorderThickness}"
BoxShadow="{DynamicResource AutoCompleteBoxPopupBoxShadow}"
CornerRadius="{DynamicResource AutoCompleteBoxPopupCornerRadius}">
<Border
CornerRadius="{DynamicResource AutoCompleteBoxPopupCornerRadius}"
ClipToBounds="True">
<ListBox
Name="PART_SelectingItemsControl"
Foreground="{TemplateBinding Foreground}"
@ -49,7 +47,6 @@
ScrollViewer.HorizontalScrollBarVisibility="Auto"
ScrollViewer.VerticalScrollBarVisibility="Auto" />
</Border>
</Border>
</Popup>
</Panel>
</DataValidationErrors>
@ -75,15 +72,13 @@
PlacementTarget="{TemplateBinding}">
<Border
Margin="{DynamicResource AutoCompleteBoxPopupMargin}"
Padding="{DynamicResource AutoCompleteBoxPopupPadding}"
HorizontalAlignment="Stretch"
Background="{DynamicResource AutoCompleteBoxPopupBackground}"
BorderBrush="{DynamicResource AutoCompleteBoxPopupBorderBrush}"
BorderThickness="{DynamicResource AutoCompleteBoxPopupBorderThickness}"
BoxShadow="{DynamicResource AutoCompleteBoxPopupBoxShadow}"
CornerRadius="{DynamicResource AutoCompleteBoxPopupCornerRadius}">
<Border
CornerRadius="{DynamicResource AutoCompleteBoxPopupCornerRadius}"
ClipToBounds="True">
<ListBox
Name="PART_SelectingItemsControl"
Foreground="{TemplateBinding Foreground}"
@ -91,7 +86,6 @@
ScrollViewer.HorizontalScrollBarVisibility="Auto"
ScrollViewer.VerticalScrollBarVisibility="Auto" />
</Border>
</Border>
</Popup>
</Panel>
</ControlTemplate>

View File

@ -102,7 +102,6 @@
Grid.Column="0"
MinWidth="{Binding Bounds.Width, RelativeSource={RelativeSource TemplatedParent}}"
MaxHeight="{TemplateBinding MaxDropDownHeight}"
ClipToBounds="False"
InheritsTransform="True"
IsLightDismissEnabled="True"
IsOpen="{TemplateBinding IsDropDownOpen, Mode=TwoWay}"
@ -112,14 +111,12 @@
Name="PopupBorder"
HorizontalAlignment="Stretch"
Margin="{DynamicResource ComboBoxPopupBorderMargin}"
Padding="{DynamicResource ComboBoxPopupBorderPadding}"
Background="{DynamicResource ComboBoxPopupBackground}"
BorderBrush="{DynamicResource ComboBoxPopupBorderBrush}"
BorderThickness="{DynamicResource ComboBoxPopupBorderThickness}"
BoxShadow="{DynamicResource ComboBoxPopupBoxShadow}"
CornerRadius="{DynamicResource ComboBoxPopupBoxCornerRadius}">
<Border
CornerRadius="{DynamicResource ComboBoxPopupBoxCornerRadius}"
ClipToBounds="True">
<ScrollViewer
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
@ -129,7 +126,6 @@
ItemsPanel="{TemplateBinding ItemsPanel}" />
</ScrollViewer>
</Border>
</Border>
</Popup>
</Grid>
</DataValidationErrors>

View File

@ -10,9 +10,6 @@
<Setter Property="Background" Value="Transparent" />
<Setter Property="Template">
<ControlTemplate TargetType="ScrollViewer">
<Border
ClipToBounds="True"
CornerRadius="{TemplateBinding CornerRadius}">
<DockPanel>
<DockPanel.Styles>
<Style Selector="RepeatButton:pressed">
@ -84,7 +81,6 @@
</ScrollContentPresenter.GestureRecognizers>
</ScrollContentPresenter>
</DockPanel>
</Border>
</ControlTemplate>
</Setter>
</ControlTheme>
@ -113,7 +109,6 @@
<ControlTheme x:Key="{x:Type MenuItem}" TargetType="MenuItem">
<Setter Property="Background" Value="{DynamicResource MenuItemBackground}" />
<Setter Property="Foreground" Value="{DynamicResource MenuItemForeground}" />
<Setter Property="CornerRadius" Value="{DynamicResource MenuItemCornerRadius}" />
<Setter Property="Cursor" Value="Hand" />
<!-- Narrow padding should be used for mouse input, when non-narrow one should be used for touch input in future. -->
<Setter Property="Padding" Value="{DynamicResource MenuItemPadding}" />

View File

@ -1,6 +1,7 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Thickness x:Key="AutoCompleteBoxPopupBorderThickness">1</Thickness>
<Thickness x:Key="AutoCompleteBoxPopupMargin">4</Thickness>
<Thickness x:Key="AutoCompleteBoxPopupPadding">0 4</Thickness>
<CornerRadius x:Key="AutoCompleteBoxPopupCornerRadius">6</CornerRadius>
<x:Double x:Key="AutoCompleteBoxDefaultHeight">32</x:Double>
<x:Double x:Key="AutoCompleteBoxSmallHeight">24</x:Double>

View File

@ -14,6 +14,7 @@
M4.08045 7.59809C4.66624 7.01231 5.61599 7.01231 6.20177 7.59809L11.8586 13.2549L17.5155 7.59809C18.1013 7.01231 19.051 7.01231 19.6368 7.59809C20.2226 8.18388 20.2226 9.13363 19.6368 9.71941L12.9193 16.4369C12.3335 17.0227 11.3838 17.0227 10.798 16.4369L4.08045 9.71941C3.49467 9.13363 3.49467 8.18388 4.08045 7.59809Z
</StreamGeometry>
<Thickness x:Key="ComboBoxPopupBorderMargin">4</Thickness>
<Thickness x:Key="ComboBoxPopupBorderPadding">0 4</Thickness>
<x:Double x:Key="ComboBoxDefaultHeight">32</x:Double>
<x:Double x:Key="ComboBoxSmallHeight">24</x:Double>

View File

@ -1,6 +1,6 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- ListBox -->
<Thickness x:Key="ListBoxItemDefaultPadding">12 8</Thickness>
<CornerRadius x:Key="ListBoxItemCornerRadius">3</CornerRadius>
<CornerRadius x:Key="ListBoxItemCornerRadius">0</CornerRadius>
</ResourceDictionary>

View File

@ -6,7 +6,7 @@
<!-- MenuFlyout -->
<Thickness x:Key="MenuFlyoutBorderThickness">1</Thickness>
<Thickness x:Key="MenuFlyoutPadding">0</Thickness>
<Thickness x:Key="MenuFlyoutPadding">0 4</Thickness>
<CornerRadius x:Key="MenuFlyoutCornerRadius">6</CornerRadius>
<x:Double x:Key="MenuFlyoutMinHeight">16</x:Double>
<x:Double x:Key="MenuFlyoutMinWidth">100</x:Double>