Merge pull request #652 from amwx/UpgradeAvalonia11.2.5

FA 2.3
This commit is contained in:
amwx
2025-03-14 19:51:22 -04:00
committed by GitHub
12 changed files with 99 additions and 20 deletions
+1 -1
View File
@@ -3,7 +3,7 @@
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<PropertyGroup>
<AvaloniaVersion>11.1.0</AvaloniaVersion>
<AvaloniaVersion>11.2.5</AvaloniaVersion>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Avalonia" Version="$(AvaloniaVersion)" />
+2 -2
View File
@@ -4,8 +4,8 @@
<Description>Control library focused on fluent design and bringing more WinUI controls into Avalonia </Description>
<PackageTags>c-sharp;xaml;cross-platform;dotnet;dotnetcore;avalonia;avaloniaui;fluent;fluent-design</PackageTags>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<Version>2.1.0</Version>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
<Version>2.3.0</Version>
<AssemblyVersion>2.3.0.0</AssemblyVersion>
</PropertyGroup>
<!-- Add Package Icon -->
@@ -40,6 +40,10 @@
<Thickness x:Key="DateTimeFlyoutBorderThickness">1</Thickness>
<x:String x:Key="DatePickerMonthTextPlaceholder">month</x:String>
<x:String x:Key="DatePickerDayTextPlaceholder">day</x:String>
<x:String x:Key="DatePickerYearTextPlaceholder">year</x:String>
<ControlTheme x:Key="DateTimePickerItem" TargetType="ListBoxItem">
<Setter Property="Foreground" Value="{DynamicResource LoopingSelectorItemForeground}" />
<Setter Property="Padding" Value="{DynamicResource DatePickerFlyoutPresenterItemPadding}"/>
@@ -271,17 +275,23 @@
VerticalContentAlignment="Stretch"
TemplatedControl.IsTemplateFocusTarget="True">
<Grid Name="PART_ButtonContentGrid" ColumnDefinitions="78*,Auto,132*,Auto,78*">
<TextBlock Name="PART_DayTextBlock" Text="day" HorizontalAlignment="Center"
<TextBlock Name="PART_DayTextBlock"
Text="{DynamicResource DatePickerDayTextPlaceholder}"
HorizontalAlignment="Center"
Padding="{DynamicResource DatePickerHostPadding}"
FontFamily="{TemplateBinding FontFamily}"
FontWeight="{TemplateBinding FontWeight}"
FontSize="{TemplateBinding FontSize}"/>
<TextBlock Name="PART_MonthTextBlock" Text="month" TextAlignment="Left"
<TextBlock Name="PART_MonthTextBlock"
Text="{DynamicResource DatePickerMonthTextPlaceholder}"
TextAlignment="Left"
Padding="{DynamicResource DatePickerHostMonthPadding}"
FontFamily="{TemplateBinding FontFamily}"
FontWeight="{TemplateBinding FontWeight}"
FontSize="{TemplateBinding FontSize}"/>
<TextBlock Name="PART_YearTextBlock" Text="year" HorizontalAlignment="Center"
<TextBlock Name="PART_YearTextBlock"
Text="{DynamicResource DatePickerYearTextPlaceholder}"
HorizontalAlignment="Center"
Padding="{DynamicResource DatePickerHostPadding}"
FontFamily="{TemplateBinding FontFamily}"
FontWeight="{TemplateBinding FontWeight}"
@@ -24,6 +24,9 @@
<x:Double x:Key="TimePickerFlyoutPresenterItemHeight">40</x:Double>
<Thickness x:Key="TimePickerFlyoutPresenterItemPadding">0,3,0,6</Thickness>
<Thickness x:Key="TimePickerHostPadding">0,3,0,6</Thickness>
<x:String x:Key="TimePickerHourTextPlaceholder">hour</x:String>
<x:String x:Key="TimePickerMinuteTextPlaceholder">minute</x:String>
<x:String x:Key="TimePickerSecondTextPlaceholder">seconds</x:String>
<ControlTheme x:Key="TimePickerFlyoutButtonStyle" TargetType="Button" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
@@ -85,6 +88,7 @@
<Border Name="PART_FirstPickerHost" Grid.Column="0"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<TextBlock Name="PART_HourTextBlock"
Text="{DynamicResource TimePickerHourTextPlaceholder}"
HorizontalAlignment="Center"
Padding="{DynamicResource TimePickerHostPadding}"
FontFamily="{TemplateBinding FontFamily}"
@@ -101,6 +105,7 @@
<Border Name="PART_SecondPickerHost" Grid.Column="2"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<TextBlock Name="PART_MinuteTextBlock"
Text="{DynamicResource TimePickerMinuteTextPlaceholder}"
HorizontalAlignment="Center"
Padding="{DynamicResource TimePickerHostPadding}"
FontFamily="{TemplateBinding FontFamily}"
@@ -116,6 +121,23 @@
<Border Name="PART_ThirdPickerHost" Grid.Column="4"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<TextBlock Name="PART_SecondTextBlock"
Text="{DynamicResource TimePickerSecondTextPlaceholder}"
HorizontalAlignment="Center"
Padding="{DynamicResource TimePickerHostPadding}"
FontFamily="{TemplateBinding FontFamily}"
FontWeight="{TemplateBinding FontWeight}"
FontSize="{TemplateBinding FontSize}" />
</Border>
<Rectangle Name="PART_ThirdColumnDivider"
Fill="{DynamicResource TimePickerSpacerFill}"
HorizontalAlignment="Center"
Width="{DynamicResource TimePickerSpacerThemeWidth}"
Grid.Column="5" />
<Border Name="PART_FourthPickerHost" Grid.Column="6"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<TextBlock Name="PART_PeriodTextBlock"
HorizontalAlignment="Center"
Padding="{DynamicResource TimePickerHostPadding}"
@@ -232,7 +254,23 @@
</Panel>
<Panel Name="PART_PeriodHost" Grid.Column="4">
<Panel Name="PART_SecondHost" Grid.Column="4">
<ScrollViewer HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Hidden">
<DateTimePickerPanel Name="PART_SecondSelector"
PanelType="Second"
ShouldLoop="True"
ItemHeight="{DynamicResource TimePickerFlyoutPresenterItemHeight}" />
</ScrollViewer>
<RepeatButton Name="PART_SecondUpButton"
Theme="{StaticResource DateTimePickerFlyoutLoopingNavButton}"
Classes="UpButton"/>
<RepeatButton Name="PART_SecondDownButton"
Theme="{StaticResource DateTimePickerFlyoutLoopingNavButton}"
Classes="DownButton"/>
</Panel>
<Panel Name="PART_PeriodHost" Grid.Column="6">
<ScrollViewer HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Hidden">
<DateTimePickerPanel Name="PART_PeriodSelector"
@@ -254,7 +292,7 @@
Background="{DynamicResource TimePickerFlyoutPresenterHighlightFill}"
Margin="4 2"
Grid.Column="0"
Grid.ColumnSpan="5"
Grid.ColumnSpan="7"
VerticalAlignment="Center"
Height="{DynamicResource TimePickerFlyoutPresenterHighlightHeight}"
CornerRadius="{DynamicResource ControlCornerRadius}"/>
@@ -270,6 +308,12 @@
HorizontalAlignment="Center"
Width="{DynamicResource TimePickerSpacerThemeWidth}"
Grid.Column="3" />
<Rectangle Name="PART_ThirdSpacer"
Fill="{DynamicResource TimePickerFlyoutPresenterSpacerFill}"
HorizontalAlignment="Center"
Width="{DynamicResource TimePickerSpacerThemeWidth}"
Grid.Column="5" />
</Grid>
<Grid Grid.Row="1" Height="{DynamicResource TimePickerFlyoutPresenterAcceptDismissHostGridHeight}"
@@ -4,13 +4,16 @@
<Design.PreviewWith>
<Border MinWidth="200" MinHeight="100" Background="#202020">
<ui:RangeSlider VerticalAlignment="Center" Margin="20"/>
<ui:RangeSlider VerticalAlignment="Center" Margin="20"
RangeStart="20" RangeEnd="80"
IsEnabled="False"/>
</Border>
</Design.PreviewWith>
<x:Double x:Key="RangeSliderTrackCornerRadius">2</x:Double>
<Thickness x:Key="RangeSliderToolTipPadding">4</Thickness>
<x:Double x:Key="RangeSliderToolTipFontSize">14</x:Double>
<x:Double x:Key="RangeSliderTrackThemeHeight">4</x:Double>
<ControlTheme TargetType="Thumb"
x:Key="RangeSliderThumbStyle"
@@ -32,7 +35,7 @@
<Border Name="OutOfRangeContentContainer"
Background="Transparent"
Margin="2 0">
<Rectangle Name="BackgroundElement" Height="2"
<Rectangle Name="BackgroundElement" Height="{DynamicResource RangeSliderTrackThemeHeight}"
Fill="{TemplateBinding Background}"
RadiusX="{DynamicResource RangeSliderTrackCornerRadius}"
RadiusY="{DynamicResource RangeSliderTrackCornerRadius}" />
@@ -43,7 +46,7 @@
Background="Transparent"
ClipToBounds="False">
<Rectangle Name="ActiveRectangle"
Height="2"
Height="{DynamicResource RangeSliderTrackThemeHeight}"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
Fill="{TemplateBinding Foreground}" />
@@ -80,6 +83,18 @@
</Panel>
</ControlTemplate>
</Setter>
<Style Selector="^:disabled /template/ Rectangle#BackgroundElement">
<Setter Property="Fill" Value="{DynamicResource SliderTrackFillDisabled}" />
</Style>
<Style Selector="^:disabled /template/ Rectangle#ActiveRectangle">
<Setter Property="Fill" Value="{DynamicResource SliderTrackValueFillDisabled}" />
</Style>
<Style Selector="^ /template/ Thumb">
<Setter Property="Background" Value="{DynamicResource SliderThumbBackgroundDisabled}" />
</Style>
</ControlTheme>
@@ -3519,7 +3519,7 @@
<StaticResource x:Key="DataGridRowHoveredBackgroundColor" ResourceKey="SubtleFillColorSecondaryBrush" />
<SolidColorBrush x:Key="DataGridDropLocationIndicatorBackground" Color="#3F4346" />
<StaticResource x:Key="DataGridScrollBarsSeparatorBackground" ResourceKey="ControlFillColorTertiaryBrush" />
<SolidColorBrush x:Key="DataGridDisabledVisualElementBackground" Color="#8CFFFFFF" />
<SolidColorBrush x:Key="DataGridDisabledVisualElementBackground" Color="#8C000000" />
<StaticResource x:Key="DataGridRowBackgroundBrush" ResourceKey="SubtleFillColorTransparentBrush" />
@@ -1,5 +1,6 @@
using Avalonia;
using Avalonia.Controls.Documents;
using Avalonia.Layout;
using Avalonia.Media;
using Avalonia.Media.TextFormatting;
@@ -48,8 +49,8 @@ public partial class FontIcon : FAIconElement
var dstRect = new Rect(Bounds.Size);
using (context.PushClip(dstRect))
{
var pt = new Point(dstRect.Center.X - _textLayout.Width / 2,
dstRect.Center.Y - _textLayout.Height / 2);
var pt = new Point(dstRect.Center.X - _textLayout.Width * 0.5,
dstRect.Center.Y - _textLayout.Height * 0.5);
_textLayout.Draw(context, pt);
}
}
@@ -87,8 +87,8 @@ public class SymbolIcon : FAIconElement
var dstRect = new Rect(Bounds.Size);
using (context.PushClip(dstRect))
{
var pt = new Point(dstRect.Center.X - _textLayout.Width / 2,
dstRect.Center.Y - _textLayout.Height / 2);
var pt = new Point(dstRect.Center.X - _textLayout.Width * 0.5,
dstRect.Center.Y - _textLayout.Height * 0.5);
_textLayout.Draw(context, pt);
}
}
@@ -4365,12 +4365,12 @@ public partial class NavigationView : HeaderedContentControl
}
}
private class StepEasingFunction : IEasing
private class StepEasingFunction : Easing
{
// TODO: What is the default step count for WinUI's StepEasingFunction
public int Steps { get; set; }
public double Ease(double progress)
public override double Ease(double progress)
{
return Math.Round(progress * Steps) * (1 / Steps);
}
@@ -19,6 +19,8 @@ public partial class ItemsRepeater : Panel
_viewManager = new ViewManager(this);
_transitionManager = new TransitionManager(this);
SetCurrentValue(LayoutProperty, new StackLayout());
AutomationProperties.SetAccessibilityView(this, AccessibilityView.Raw);
SetValue(KeyboardNavigation.TabNavigationProperty, KeyboardNavigationMode.Once);
XYFocus.SetNavigationModes(this, XYFocusNavigationModes.Enabled);
@@ -28,7 +28,7 @@ public partial class ItemsRepeater : Panel
/// Defines the <see cref="Layout"/> property
/// </summary>
public static readonly StyledProperty<Layout> LayoutProperty =
AvaloniaProperty.Register<ItemsRepeater, Layout>(nameof(Layout), defaultValue: new StackLayout());
AvaloniaProperty.Register<ItemsRepeater, Layout>(nameof(Layout));
/// <summary>
/// Defines the <see cref="ItemsSource"/> property
@@ -4,6 +4,7 @@ using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Metadata;
using Avalonia.Controls.Primitives;
using Avalonia.Controls.Primitives.PopupPositioning;
using Avalonia.Controls.Shapes;
using Avalonia.Controls.Templates;
using Avalonia.Input;
@@ -402,7 +403,13 @@ public class TabViewListView : ListBox
if (!_isInDrag && _initialPoint.HasValue)
{
_dragReorderPopup.Host?.ConfigurePosition(this, PlacementMode.Pointer, _popupOffset);
_dragReorderPopup.CustomPopupPlacementCallback = new CustomPopupPlacementCallback(x =>
{
x.Offset = _popupOffset;
});
//var req = PopupPositionRequest.
//_dragReorderPopup.Host?
// .ConfigurePosition(this, PlacementMode.Pointer, _popupOffset);
}
}