diff --git a/.ncrunch/Avalonia.Generators.Tests.v3.ncrunchproject b/.ncrunch/Avalonia.Generators.Tests.v3.ncrunchproject new file mode 100644 index 0000000000..319cd523ce --- /dev/null +++ b/.ncrunch/Avalonia.Generators.Tests.v3.ncrunchproject @@ -0,0 +1,5 @@ + + + True + + \ No newline at end of file diff --git a/.ncrunch/Generators.Sandbox.v3.ncrunchproject b/.ncrunch/Generators.Sandbox.v3.ncrunchproject new file mode 100644 index 0000000000..319cd523ce --- /dev/null +++ b/.ncrunch/Generators.Sandbox.v3.ncrunchproject @@ -0,0 +1,5 @@ + + + True + + \ No newline at end of file diff --git a/native/Avalonia.Native/src/OSX/WindowImpl.mm b/native/Avalonia.Native/src/OSX/WindowImpl.mm index 104611eabc..925880534a 100644 --- a/native/Avalonia.Native/src/OSX/WindowImpl.mm +++ b/native/Avalonia.Native/src/OSX/WindowImpl.mm @@ -281,10 +281,13 @@ HRESULT WindowImpl::SetDecorations(SystemDecorations value) { case SystemDecorationsFull: [Window setHasShadow:YES]; - [Window setTitleVisibility:NSWindowTitleVisible]; - [Window setTitlebarAppearsTransparent:NO]; [Window setTitle:_lastTitle]; + if (!_isClientAreaExtended) { + [Window setTitleVisibility:NSWindowTitleVisible]; + [Window setTitlebarAppearsTransparent:NO]; + } + if (currentWindowState == Maximized) { auto newFrame = [Window contentRectForFrameRect:[Window frame]].size; @@ -611,7 +614,8 @@ void WindowImpl::UpdateStyle() { } bool wantsChrome = (_extendClientHints & AvnSystemChrome) || (_extendClientHints & AvnPreferSystemChrome); - bool hasTrafficLights = _isClientAreaExtended ? wantsChrome : _decorations == SystemDecorationsFull; + bool hasTrafficLights = (_decorations == SystemDecorationsFull) && + (_isClientAreaExtended ? wantsChrome : true); NSButton* closeButton = [Window standardWindowButton:NSWindowCloseButton]; NSButton* miniaturizeButton = [Window standardWindowButton:NSWindowMiniaturizeButton]; diff --git a/samples/ControlCatalog/MainView.xaml b/samples/ControlCatalog/MainView.xaml index 3681298a72..9f06525821 100644 --- a/samples/ControlCatalog/MainView.xaml +++ b/samples/ControlCatalog/MainView.xaml @@ -241,7 +241,7 @@ diff --git a/samples/ControlCatalog/Pages/ClipboardPage.xaml.cs b/samples/ControlCatalog/Pages/ClipboardPage.xaml.cs index ef3d2bbafa..b6b2ac7181 100644 --- a/samples/ControlCatalog/Pages/ClipboardPage.xaml.cs +++ b/samples/ControlCatalog/Pages/ClipboardPage.xaml.cs @@ -1,16 +1,23 @@ using System; using System.Collections.Generic; - +using System.Linq; using Avalonia; using Avalonia.Controls; +using Avalonia.Controls.Notifications; using Avalonia.Input; using Avalonia.Interactivity; using Avalonia.Markup.Xaml; +using Avalonia.Platform; +using Avalonia.Platform.Storage; +using Avalonia.Platform.Storage.FileIO; namespace ControlCatalog.Pages { public partial class ClipboardPage : UserControl { + private INotificationManager? _notificationManager; + private INotificationManager NotificationManager => _notificationManager + ??= new WindowNotificationManager(TopLevel.GetTopLevel(this)!); public ClipboardPage() { InitializeComponent(); @@ -31,7 +38,7 @@ namespace ControlCatalog.Pages private async void PasteText(object? sender, RoutedEventArgs args) { - if(Application.Current!.Clipboard is { } clipboard) + if (Application.Current!.Clipboard is { } clipboard) { ClipboardContent.Text = await clipboard.GetTextAsync(); } @@ -59,15 +66,45 @@ namespace ControlCatalog.Pages { if (Application.Current!.Clipboard is { } clipboard) { - var files = (ClipboardContent.Text ?? String.Empty) - .Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries); - if (files.Length == 0) + var storageProvider = TopLevel.GetTopLevel(this)!.StorageProvider; + var filesPath = (ClipboardContent.Text ?? string.Empty) + .Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries); + if (filesPath.Length == 0) { return; } - var dataObject = new DataObject(); - dataObject.Set(DataFormats.FileNames, files); - await clipboard.SetDataObjectAsync(dataObject); + List invalidFile = new(filesPath.Length); + List files = new(filesPath.Length); + + for (int i = 0; i < filesPath.Length; i++) + { + var file = await storageProvider.TryGetFileFromPathAsync(filesPath[i]); + if (file is null) + { + invalidFile.Add(filesPath[i]); + } + else + { + files.Add(file); + } + } + + if (invalidFile.Count > 0) + { + NotificationManager.Show(new Notification("Warning", "There is one o more invalid path.", NotificationType.Warning)); + } + + if (files.Count > 0) + { + var dataObject = new DataObject(); + dataObject.Set(DataFormats.Files, files); + await clipboard.SetDataObjectAsync(dataObject); + NotificationManager.Show(new Notification("Success", "Copy completated.", NotificationType.Success)); + } + else + { + NotificationManager.Show(new Notification("Warning", "Any files to copy in Clipboard.", NotificationType.Warning)); + } } } @@ -75,8 +112,9 @@ namespace ControlCatalog.Pages { if (Application.Current!.Clipboard is { } clipboard) { - var fiels = await clipboard.GetDataAsync(DataFormats.FileNames) as IEnumerable; - ClipboardContent.Text = fiels != null ? string.Join(Environment.NewLine, fiels) : string.Empty; + var files = await clipboard.GetDataAsync(DataFormats.Files) as IEnumerable; + + ClipboardContent.Text = files != null ? string.Join(Environment.NewLine, files.Select(f => f.TryGetLocalPath() ?? f.Name)) : string.Empty; } } @@ -95,7 +133,7 @@ namespace ControlCatalog.Pages { await clipboard.ClearAsync(); } - + } } } diff --git a/samples/ControlCatalog/Pages/ComboBoxPage.xaml.cs b/samples/ControlCatalog/Pages/ComboBoxPage.xaml.cs index 6d759597b5..47f97e63a3 100644 --- a/samples/ControlCatalog/Pages/ComboBoxPage.xaml.cs +++ b/samples/ControlCatalog/Pages/ComboBoxPage.xaml.cs @@ -18,7 +18,7 @@ namespace ControlCatalog.Pages { AvaloniaXamlLoader.Load(this); var fontComboBox = this.Get("fontComboBox"); - fontComboBox.Items = FontManager.Current.SystemFonts; + fontComboBox.ItemsSource = FontManager.Current.SystemFonts; fontComboBox.SelectedIndex = 0; } } diff --git a/samples/ControlCatalog/Pages/CompositionPage.axaml.cs b/samples/ControlCatalog/Pages/CompositionPage.axaml.cs index 8b12a2d663..0d3061f361 100644 --- a/samples/ControlCatalog/Pages/CompositionPage.axaml.cs +++ b/samples/ControlCatalog/Pages/CompositionPage.axaml.cs @@ -32,7 +32,7 @@ public partial class CompositionPage : UserControl protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e) { base.OnAttachedToVisualTree(e); - this.Get("Items").Items = CreateColorItems(); + this.Get("Items").ItemsSource = CreateColorItems(); } diff --git a/samples/ControlCatalog/Pages/ContextFlyoutPage.xaml b/samples/ControlCatalog/Pages/ContextFlyoutPage.xaml index 6ef6a202b6..cb294442d2 100644 --- a/samples/ControlCatalog/Pages/ContextFlyoutPage.xaml +++ b/samples/ControlCatalog/Pages/ContextFlyoutPage.xaml @@ -61,7 +61,7 @@ diff --git a/samples/ControlCatalog/Pages/ContextMenuPage.xaml b/samples/ControlCatalog/Pages/ContextMenuPage.xaml index 962f0308f7..06eba52605 100644 --- a/samples/ControlCatalog/Pages/ContextMenuPage.xaml +++ b/samples/ControlCatalog/Pages/ContextMenuPage.xaml @@ -51,13 +51,13 @@ - + diff --git a/samples/ControlCatalog/Pages/CursorPage.xaml b/samples/ControlCatalog/Pages/CursorPage.xaml index 30bad06d72..66f2b8b2e3 100644 --- a/samples/ControlCatalog/Pages/CursorPage.xaml +++ b/samples/ControlCatalog/Pages/CursorPage.xaml @@ -8,7 +8,7 @@ Defines a cursor (mouse pointer) - + @@ -68,7 +68,7 @@ - + - + + Placement="Bottom"> diff --git a/src/Avalonia.Themes.Fluent/Controls/ManagedFileChooser.xaml b/src/Avalonia.Themes.Fluent/Controls/ManagedFileChooser.xaml index d2581caaf5..b3453569a4 100644 --- a/src/Avalonia.Themes.Fluent/Controls/ManagedFileChooser.xaml +++ b/src/Avalonia.Themes.Fluent/Controls/ManagedFileChooser.xaml @@ -136,7 +136,7 @@ x:DataType="internal:ManagedFileChooserViewModel"> - + @@ -173,7 +173,7 @@ @@ -220,7 +220,7 @@ diff --git a/src/Avalonia.Themes.Fluent/Controls/NativeMenuBar.xaml b/src/Avalonia.Themes.Fluent/Controls/NativeMenuBar.xaml index d5c95ab46c..515a5a730b 100644 --- a/src/Avalonia.Themes.Fluent/Controls/NativeMenuBar.xaml +++ b/src/Avalonia.Themes.Fluent/Controls/NativeMenuBar.xaml @@ -7,13 +7,13 @@ + ItemsSource="{Binding $parent[TopLevel].(NativeMenu.Menu).Items}">