Merge pull request #38 from irihitech/fix

Fix: Fix several issues.
This commit is contained in:
Dong Bin 2023-01-24 13:39:52 +08:00 committed by GitHub
commit f7e61c62d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 38 additions and 30 deletions

View File

@ -12,6 +12,7 @@
<Setter Property="FlyoutPresenter.MaxWidth" Value="{DynamicResource FlyoutMaxWidth}" /> <Setter Property="FlyoutPresenter.MaxWidth" Value="{DynamicResource FlyoutMaxWidth}" />
<Setter Property="FlyoutPresenter.MinHeight" Value="{DynamicResource FlyoutMinHeight}" /> <Setter Property="FlyoutPresenter.MinHeight" Value="{DynamicResource FlyoutMinHeight}" />
<Setter Property="FlyoutPresenter.MaxHeight" Value="{DynamicResource FlyoutMaxHeight}" /> <Setter Property="FlyoutPresenter.MaxHeight" Value="{DynamicResource FlyoutMaxHeight}" />
<Setter Property="FlyoutPresenter.Foreground" Value="{DynamicResource FlyoutForeground}" />
<Setter Property="FlyoutPresenter.ClipToBounds" Value="False" /> <Setter Property="FlyoutPresenter.ClipToBounds" Value="False" />
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" /> <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" /> <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
@ -37,7 +38,8 @@
VerticalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
Content="{TemplateBinding Content}" Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}" ContentTemplate="{TemplateBinding ContentTemplate}"
FontWeight="{TemplateBinding FontWeight}" /> FontWeight="{TemplateBinding FontWeight}"
TextElement.Foreground="{TemplateBinding Foreground}" />
</ScrollViewer> </ScrollViewer>
</Border> </Border>
</ControlTemplate> </ControlTemplate>

View File

@ -18,8 +18,6 @@
ShowButtonSpinner="{TemplateBinding ShowButtonSpinner}"> ShowButtonSpinner="{TemplateBinding ShowButtonSpinner}">
<TextBox <TextBox
Name="PART_TextBox" Name="PART_TextBox"
MinWidth="0"
Padding="{TemplateBinding Padding}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
AcceptsReturn="False" AcceptsReturn="False"

View File

@ -88,12 +88,14 @@
<Grid ColumnDefinitions="Auto,*,Auto, Auto, Auto"> <Grid ColumnDefinitions="Auto,*,Auto, Auto, Auto">
<ContentPresenter <ContentPresenter
Grid.Column="0" Grid.Column="0"
Padding="{DynamicResource TextBoxInnerContentPadding}" Padding="{DynamicResource TextBoxInnerLeftContentPadding}"
VerticalAlignment="Center" VerticalAlignment="Center"
Content="{TemplateBinding InnerLeftContent}" Content="{TemplateBinding InnerLeftContent}"
Foreground="{DynamicResource TextBoxInnerForeground}" /> Foreground="{DynamicResource TextBoxInnerForeground}"
IsVisible="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=InnerLeftContent, Converter={x:Static ObjectConverters.IsNotNull}}" />
<ScrollViewer <ScrollViewer
Grid.Column="1" Grid.Column="1"
Margin="{TemplateBinding Padding}"
AllowAutoHide="{TemplateBinding (ScrollViewer.AllowAutoHide)}" AllowAutoHide="{TemplateBinding (ScrollViewer.AllowAutoHide)}"
HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}" HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}"
IsScrollChainingEnabled="{TemplateBinding (ScrollViewer.IsScrollChainingEnabled)}" IsScrollChainingEnabled="{TemplateBinding (ScrollViewer.IsScrollChainingEnabled)}"
@ -144,10 +146,11 @@
Theme="{StaticResource InputToggleButton}" /> Theme="{StaticResource InputToggleButton}" />
<ContentPresenter <ContentPresenter
Grid.Column="4" Grid.Column="4"
Padding="{DynamicResource TextBoxInnerContentPadding}" Padding="{DynamicResource TextBoxInnerRightContentPadding}"
VerticalAlignment="Center" VerticalAlignment="Center"
Content="{TemplateBinding InnerRightContent}" Content="{TemplateBinding InnerRightContent}"
Foreground="{DynamicResource TextBoxInnerForeground}" /> Foreground="{DynamicResource TextBoxInnerForeground}"
IsVisible="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=InnerRightContent, Converter={x:Static ObjectConverters.IsNotNull}}" />
</Grid> </Grid>
</Border> </Border>
</ControlTemplate> </ControlTemplate>

View File

@ -1,10 +1,12 @@
<ResourceDictionary <ResourceDictionary
xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="clr-namespace:Avalonia.Controls.Converters;assembly=Avalonia.Controls"> xmlns:converters="clr-namespace:Avalonia.Controls.Converters;assembly=Avalonia.Controls">
<Design.PreviewWith> <Design.PreviewWith>
<StackPanel <StackPanel
Height="200" Margin="20" Height="200"
Margin="20"
Spacing="20"> Spacing="20">
<TreeView> <TreeView>
<TreeViewItem Header="Level 1"> <TreeViewItem Header="Level 1">
@ -62,7 +64,9 @@
<Border <Border
Width="{TemplateBinding Width}" Width="{TemplateBinding Width}"
Height="{TemplateBinding Height}" Height="{TemplateBinding Height}"
HorizontalAlignment="Center" VerticalAlignment="Center" Padding="{TemplateBinding Padding}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="Transparent"> Background="Transparent">
<PathIcon <PathIcon
Name="PART_ExpandIconPath" Name="PART_ExpandIconPath"
@ -100,30 +104,31 @@
<Border <Border
Name="PART_LayoutRoot" Name="PART_LayoutRoot"
MinHeight="{TemplateBinding MinHeight}" MinHeight="{TemplateBinding MinHeight}"
Padding="{DynamicResource TreeViewItemPadding}"
Background="{TemplateBinding Background}" Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}" CornerRadius="{TemplateBinding CornerRadius}"
Focusable="True" TemplatedControl.IsTemplateFocusTarget="True"> Focusable="True"
TemplatedControl.IsTemplateFocusTarget="True">
<Grid <Grid
Name="PART_Header" Name="PART_Header"
Margin="{TemplateBinding Level, Margin="{TemplateBinding Level,
Mode=OneWay, Mode=OneWay,
Converter={StaticResource TreeViewItemLeftMarginConverter}}" Converter={StaticResource TreeViewItemLeftMarginConverter}}"
ColumnDefinitions="Auto, *"> ColumnDefinitions="Auto, *">
<Panel <ToggleButton
Name="PART_ExpandCollapseChevronContainer" Grid.Column="0" Name="PART_ExpandCollapseChevron"
Margin="{StaticResource TreeViewItemIconMargin}"> Grid.Column="0"
<ToggleButton Padding="{DynamicResource TreeViewItemIconMargin}"
Name="PART_ExpandCollapseChevron" Focusable="False" Focusable="False"
IsChecked="{TemplateBinding IsExpanded, IsChecked="{TemplateBinding IsExpanded,
Mode=TwoWay}" Mode=TwoWay}"
Theme="{StaticResource ToggleButtonTreeViewItemIconButton}" /> Theme="{StaticResource ToggleButtonTreeViewItemIconButton}" />
</Panel>
<ContentPresenter <ContentPresenter
Name="PART_HeaderPresenter" Grid.Column="1" Name="PART_HeaderPresenter"
Grid.Column="1"
Margin="{TemplateBinding Padding}" Margin="{TemplateBinding Padding}"
Padding="{DynamicResource TreeViewItemPadding}"
HorizontalAlignment="{TemplateBinding HorizontalAlignment}" HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
VerticalAlignment="{TemplateBinding VerticalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}"
Content="{TemplateBinding Header}" Content="{TemplateBinding Header}"

View File

@ -3,10 +3,8 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=System.Runtime"> xmlns:sys="clr-namespace:System;assembly=System.Runtime">
<SolidColorBrush x:Key="FlyoutBackground" Color="White" /> <SolidColorBrush x:Key="FlyoutBackground" Color="White" />
<SolidColorBrush <SolidColorBrush x:Key="FlyoutForeground" Color="#1C1F23" />
x:Key="FlyoutBorderBrush" <SolidColorBrush x:Key="FlyoutBorderBrush" Opacity="0.08" Color="#1C1F23" />
Opacity="0.08"
Color="#1C1F23" />
<FontWeight x:Key="FlyoutFontWeight">400</FontWeight> <FontWeight x:Key="FlyoutFontWeight">400</FontWeight>
<Thickness x:Key="FlyoutBorderThickness">1</Thickness> <Thickness x:Key="FlyoutBorderThickness">1</Thickness>
<BoxShadows x:Key="FlyoutBorderBoxShadow">0 0 8 0 #1A000000</BoxShadows> <BoxShadows x:Key="FlyoutBorderBoxShadow">0 0 8 0 #1A000000</BoxShadows>

View File

@ -38,7 +38,8 @@
<CornerRadius x:Key="TextBoxPrefixContentCornerRadius">0 3 3 0</CornerRadius> <CornerRadius x:Key="TextBoxPrefixContentCornerRadius">0 3 3 0</CornerRadius>
<CornerRadius x:Key="TextBoxBothContentCornerRadius">0 0 0 0</CornerRadius> <CornerRadius x:Key="TextBoxBothContentCornerRadius">0 0 0 0</CornerRadius>
<Thickness x:Key="TextBoxInnerContentPadding">8 0</Thickness> <Thickness x:Key="TextBoxInnerLeftContentPadding">8 0 0 0</Thickness>
<Thickness x:Key="TextBoxInnerRightContentPadding">0 0 8 0</Thickness>
<Thickness x:Key="TextBoxContentPadding">8 0</Thickness> <Thickness x:Key="TextBoxContentPadding">8 0</Thickness>
<Thickness x:Key="TextBoxBorderThickness">1</Thickness> <Thickness x:Key="TextBoxBorderThickness">1</Thickness>

View File

@ -1,5 +1,6 @@
<ResourceDictionary <ResourceDictionary
xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=System.Runtime"> xmlns:sys="clr-namespace:System;assembly=System.Runtime">
<sys:Double x:Key="TreeViewItemIndent">20</sys:Double> <sys:Double x:Key="TreeViewItemIndent">20</sys:Double>
<sys:Double x:Key="TreeViewItemIconSize">8</sys:Double> <sys:Double x:Key="TreeViewItemIconSize">8</sys:Double>
@ -19,6 +20,6 @@
<SolidColorBrush x:Key="TreeViewItemDisabledBackground" Color="Transparent" /> <SolidColorBrush x:Key="TreeViewItemDisabledBackground" Color="Transparent" />
<SolidColorBrush x:Key="TreeViewItemSelectedDisabledBackground" Opacity="0.04" Color="#2E3238" /> <SolidColorBrush x:Key="TreeViewItemSelectedDisabledBackground" Opacity="0.04" Color="#2E3238" />
<Thickness x:Key="TreeViewItemIconMargin">0 0 8 0</Thickness> <Thickness x:Key="TreeViewItemIconMargin">8 0</Thickness>
<Thickness x:Key="TreeViewItemPadding">8 4 0 4</Thickness> <Thickness x:Key="TreeViewItemPadding">0 4 0 4</Thickness>
</ResourceDictionary> </ResourceDictionary>