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

View File

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

View File

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

View File

@ -1,10 +1,12 @@
<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">
<Design.PreviewWith>
<StackPanel
Height="200" Margin="20"
Height="200"
Margin="20"
Spacing="20">
<TreeView>
<TreeViewItem Header="Level 1">
@ -62,7 +64,9 @@
<Border
Width="{TemplateBinding Width}"
Height="{TemplateBinding Height}"
HorizontalAlignment="Center" VerticalAlignment="Center"
Padding="{TemplateBinding Padding}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="Transparent">
<PathIcon
Name="PART_ExpandIconPath"
@ -100,30 +104,31 @@
<Border
Name="PART_LayoutRoot"
MinHeight="{TemplateBinding MinHeight}"
Padding="{DynamicResource TreeViewItemPadding}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"
Focusable="True" TemplatedControl.IsTemplateFocusTarget="True">
Focusable="True"
TemplatedControl.IsTemplateFocusTarget="True">
<Grid
Name="PART_Header"
Margin="{TemplateBinding Level,
Mode=OneWay,
Converter={StaticResource TreeViewItemLeftMarginConverter}}"
ColumnDefinitions="Auto, *">
<Panel
Name="PART_ExpandCollapseChevronContainer" Grid.Column="0"
Margin="{StaticResource TreeViewItemIconMargin}">
<ToggleButton
Name="PART_ExpandCollapseChevron" Focusable="False"
Name="PART_ExpandCollapseChevron"
Grid.Column="0"
Padding="{DynamicResource TreeViewItemIconMargin}"
Focusable="False"
IsChecked="{TemplateBinding IsExpanded,
Mode=TwoWay}"
Theme="{StaticResource ToggleButtonTreeViewItemIconButton}" />
</Panel>
<ContentPresenter
Name="PART_HeaderPresenter" Grid.Column="1"
Name="PART_HeaderPresenter"
Grid.Column="1"
Margin="{TemplateBinding Padding}"
Padding="{DynamicResource TreeViewItemPadding}"
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
VerticalAlignment="{TemplateBinding VerticalAlignment}"
Content="{TemplateBinding Header}"

View File

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

View File

@ -1,5 +1,6 @@
<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">
<sys:Double x:Key="TreeViewItemIndent">20</sys:Double>
<sys:Double x:Key="TreeViewItemIconSize">8</sys:Double>
@ -19,6 +20,6 @@
<SolidColorBrush x:Key="TreeViewItemDisabledBackground" Color="Transparent" />
<SolidColorBrush x:Key="TreeViewItemSelectedDisabledBackground" Opacity="0.04" Color="#2E3238" />
<Thickness x:Key="TreeViewItemIconMargin">0 0 8 0</Thickness>
<Thickness x:Key="TreeViewItemPadding">8 4 0 4</Thickness>
<Thickness x:Key="TreeViewItemIconMargin">8 0</Thickness>
<Thickness x:Key="TreeViewItemPadding">0 4 0 4</Thickness>
</ResourceDictionary>