diff --git a/Harmonia.Core/Harmonia.Core.csproj b/Harmonia.Core/Harmonia.Core.csproj index 5de2c66..def5f62 100644 --- a/Harmonia.Core/Harmonia.Core.csproj +++ b/Harmonia.Core/Harmonia.Core.csproj @@ -9,10 +9,10 @@ - - - - + + + + diff --git a/Harmonia.Tests/Harmonia.Tests.csproj b/Harmonia.Tests/Harmonia.Tests.csproj index 49da78c..feea513 100644 --- a/Harmonia.Tests/Harmonia.Tests.csproj +++ b/Harmonia.Tests/Harmonia.Tests.csproj @@ -16,7 +16,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/Harmonia.UI.Desktop/Harmonia.UI.Desktop.csproj b/Harmonia.UI.Desktop/Harmonia.UI.Desktop.csproj index e0ca42c..f800571 100644 --- a/Harmonia.UI.Desktop/Harmonia.UI.Desktop.csproj +++ b/Harmonia.UI.Desktop/Harmonia.UI.Desktop.csproj @@ -10,7 +10,7 @@ - + diff --git a/Harmonia.UI/App.axaml b/Harmonia.UI/App.axaml index 913dc84..fdf6b04 100644 --- a/Harmonia.UI/App.axaml +++ b/Harmonia.UI/App.axaml @@ -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"> diff --git a/Harmonia.UI/App.axaml.cs b/Harmonia.UI/App.axaml.cs index 4d72c8f..1c1bd3b 100644 --- a/Harmonia.UI/App.axaml.cs +++ b/Harmonia.UI/App.axaml.cs @@ -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) { diff --git a/Harmonia.UI/Controls/AnimatedFlyout.cs b/Harmonia.UI/Controls/AnimatedFlyout.cs index d76e439..5d0bb1b 100644 --- a/Harmonia.UI/Controls/AnimatedFlyout.cs +++ b/Harmonia.UI/Controls/AnimatedFlyout.cs @@ -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) { diff --git a/Harmonia.UI/Harmonia.UI.csproj b/Harmonia.UI/Harmonia.UI.csproj index 331e3ee..350b800 100644 --- a/Harmonia.UI/Harmonia.UI.csproj +++ b/Harmonia.UI/Harmonia.UI.csproj @@ -11,15 +11,16 @@ - - - + + + - - - + + + + diff --git a/Harmonia.UI/Platform/PlatformServiceLocator.cs b/Harmonia.UI/Platform/PlatformServiceLocator.cs index c46c954..94b8c40 100644 --- a/Harmonia.UI/Platform/PlatformServiceLocator.cs +++ b/Harmonia.UI/Platform/PlatformServiceLocator.cs @@ -24,7 +24,9 @@ public abstract class PlatformServiceLocator : IPlatformServiceLocator 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) { diff --git a/Harmonia.UI/ViewModels/PlaylistViewModel.cs b/Harmonia.UI/ViewModels/PlaylistViewModel.cs index 41fab8c..4407caa 100644 --- a/Harmonia.UI/ViewModels/PlaylistViewModel.cs +++ b/Harmonia.UI/ViewModels/PlaylistViewModel.cs @@ -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 []; diff --git a/Harmonia.UI/Views/PlaylistView.axaml b/Harmonia.UI/Views/PlaylistView.axaml index 86a602d..693ce62 100644 --- a/Harmonia.UI/Views/PlaylistView.axaml +++ b/Harmonia.UI/Views/PlaylistView.axaml @@ -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 @@ + + + + diff --git a/Harmonia.UI/Views/PlaylistView.axaml.cs b/Harmonia.UI/Views/PlaylistView.axaml.cs index 3c592f9..8a0ef16 100644 --- a/Harmonia.UI/Views/PlaylistView.axaml.cs +++ b/Harmonia.UI/Views/PlaylistView.axaml.cs @@ -243,7 +243,7 @@ public partial class PlaylistView : UserControl // AddHandler(DragDrop.DragLeaveEvent, DragLeave); //} - private async void StartDrag(object? sender, Action factory, PointerPressedEventArgs e, DragDropEffects effects) + private async void StartDrag(object? sender, Action 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)