Updated packages. Migrated Avalonia UI to 12.0.

This commit is contained in:
2026-04-15 09:52:25 -04:00
parent c747635703
commit 5f7b716d25
11 changed files with 32 additions and 21 deletions

View File

@@ -4,6 +4,7 @@
xmlns:control="clr-namespace:Harmonia.UI.Controls"
xmlns:converters="clr-namespace:Harmonia.UI.Converters"
xmlns:semi="https://irihi.tech/semi"
xmlns:ia="using:Avalonia.Xaml.Interactions.Animated"
x:Class="Harmonia.UI.App"
RequestedThemeVariant="Default">
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->

View File

@@ -45,7 +45,7 @@ public partial class App : Application
{
// Line below is needed to remove Avalonia data validation.
// Without this line you will get duplicate validations from both Avalonia and CT
BindingPlugins.DataValidators.RemoveAt(0);
//BindingPlugins.DataValidators.RemoveAt(0);
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{

View File

@@ -90,7 +90,9 @@ public class AnimatedMenuFlyout : MenuFlyout
//Android (and iOS?)
else if (Application.Current?.ApplicationLifetime is ISingleViewApplicationLifetime singleViewPlatform)
{
IRenderRoot? visualRoot = singleViewPlatform.MainView?.GetVisualRoot();
//IRenderRoot? visualRoot = singleViewPlatform.MainView?.GetVisualRoot();
Visual? visualRoot = singleViewPlatform.MainView?.GetPresentationSource()?.RootVisual;
if (visualRoot is TopLevel topLevel)
{

View File

@@ -11,15 +11,16 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="11.3.13" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.3.13" />
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.3.13" />
<PackageReference Include="Avalonia" Version="12.0.1" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="12.0.1" />
<PackageReference Include="Avalonia.Fonts.Inter" Version="12.0.1" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.2" />
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.3.13" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.5" />
<PackageReference Include="Semi.Avalonia" Version="11.3.7.3" />
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.3.14" />
<PackageReference Include="Egolds.Xaml.Behaviors.Interactions.Animated" Version="11.3.3" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.6" />
<PackageReference Include="Semi.Avalonia" Version="12.0.0" />
</ItemGroup>
<ItemGroup>

View File

@@ -24,7 +24,9 @@ public abstract class PlatformServiceLocator<T> : IPlatformServiceLocator<T>
if (singleViewPlatform.MainView == null)
return default;
IRenderRoot? visualRoot = singleViewPlatform.MainView.GetVisualRoot();
//IRenderRoot? visualRoot = singleViewPlatform.MainView.GetVisualRoot();
Visual? visualRoot = singleViewPlatform.MainView?.GetPresentationSource()?.RootVisual;
if (visualRoot is TopLevel topLevel)
{

View File

@@ -450,7 +450,7 @@ public class PlaylistViewModel : ViewModelBase
if (clipboard == null)
return [];
string? clipboardText = await clipboard.GetTextAsync();
string? clipboardText = await clipboard.TryGetTextAsync();
if (string.IsNullOrWhiteSpace(clipboardText))
return [];

View File

@@ -5,6 +5,7 @@
xmlns:vm="clr-namespace:Harmonia.UI.ViewModels"
xmlns:converter="clr-namespace:Harmonia.UI.Converters"
xmlns:controls="clr-namespace:Harmonia.UI.Controls"
xmlns:ia="using:Avalonia.Xaml.Interactions.Animated"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
DataContext="{x:Static vm:ViewModelLocator.PlaylistViewModel}"
x:Class="Harmonia.UI.Views.PlaylistView"
@@ -155,11 +156,15 @@
<!--<ListBox.Styles>
<Style Selector="ListBoxItem:nth-child(odd):not(:pointerover):not(:selected)">
<Setter Property="Background" Value="#00000000"/>
--><!-- Light Gray --><!--
-->
<!-- Light Gray -->
<!--
</Style>
<Style Selector="ListBoxItem:nth-child(even):not(:pointerover):not(:selected)">
<Setter Property="Background" Value="#22AAAAAA"/>
--><!-- Slightly Darker Gray --><!--
-->
<!-- Slightly Darker Gray -->
<!--
</Style>
</ListBox.Styles>-->
<ListBox.ItemTemplate>

View File

@@ -243,7 +243,7 @@ public partial class PlaylistView : UserControl
// AddHandler(DragDrop.DragLeaveEvent, DragLeave);
//}
private async void StartDrag(object? sender, Action<DataObject> factory, PointerPressedEventArgs e, DragDropEffects effects)
private async void StartDrag(object? sender, Action<DataTransfer> factory, PointerPressedEventArgs e, DragDropEffects effects)
{
if (e.GetCurrentPoint((Visual)sender!).Properties.IsLeftButtonPressed == false)
{
@@ -253,10 +253,10 @@ public partial class PlaylistView : UserControl
return;
}
var dragData = new DataObject();
var dragData = new DataTransfer();
factory(dragData);
var result = await DragDrop.DoDragDrop(e, dragData, effects);
var result = await DragDrop.DoDragDropAsync(e, dragData, effects);
}
private void DragOver(object? sender, DragEventArgs e)