diff --git a/.gitignore b/.gitignore index bbf358b8f4..ee778ed4e2 100644 --- a/.gitignore +++ b/.gitignore @@ -102,6 +102,7 @@ csx AppPackages/ # NCrunch +.NCrunch_*/ _NCrunch_*/ *.ncrunchsolution.user nCrunchTemp_* 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/Avalonia.Desktop.slnf b/Avalonia.Desktop.slnf index a87b83de8b..76620e8b93 100644 --- a/Avalonia.Desktop.slnf +++ b/Avalonia.Desktop.slnf @@ -39,6 +39,7 @@ "src\\Markup\\Avalonia.Markup\\Avalonia.Markup.csproj", "src\\Skia\\Avalonia.Skia\\Avalonia.Skia.csproj", "src\\tools\\Avalonia.Generators\\Avalonia.Generators.csproj", + "src\\tools\\Avalonia.Generators\\Avalonia.Generators.csproj", "src\\tools\\DevAnalyzers\\DevAnalyzers.csproj", "src\\tools\\DevGenerators\\DevGenerators.csproj", "src\\tools\\PublicAnalyzers\\Avalonia.Analyzers.csproj", diff --git a/native/Avalonia.Native/src/OSX/AvnWindow.mm b/native/Avalonia.Native/src/OSX/AvnWindow.mm index b1fb915e04..16e1486acc 100644 --- a/native/Avalonia.Native/src/OSX/AvnWindow.mm +++ b/native/Avalonia.Native/src/OSX/AvnWindow.mm @@ -394,7 +394,7 @@ - (BOOL)windowShouldZoom:(NSWindow *_Nonnull)window toFrame:(NSRect)newFrame { - return true; + return _parent->CanZoom(); } -(void)windowDidResignKey:(NSNotification *)notification diff --git a/native/Avalonia.Native/src/OSX/WindowBaseImpl.h b/native/Avalonia.Native/src/OSX/WindowBaseImpl.h index be7d933b6a..bc35ca670f 100644 --- a/native/Avalonia.Native/src/OSX/WindowBaseImpl.h +++ b/native/Avalonia.Native/src/OSX/WindowBaseImpl.h @@ -107,6 +107,8 @@ BEGIN_INTERFACE_MAP() virtual HRESULT GetInputMethod(IAvnTextInputMethod **retOut) override; + virtual bool CanZoom() { return false; } + protected: virtual NSWindowStyleMask CalculateStyleMask() = 0; virtual void UpdateStyle(); diff --git a/native/Avalonia.Native/src/OSX/WindowImpl.h b/native/Avalonia.Native/src/OSX/WindowImpl.h index 29bb659039..5140124a17 100644 --- a/native/Avalonia.Native/src/OSX/WindowImpl.h +++ b/native/Avalonia.Native/src/OSX/WindowImpl.h @@ -97,6 +97,8 @@ BEGIN_INTERFACE_MAP() bool CanBecomeKeyWindow (); + bool CanZoom() override { return _isEnabled && _canResize; } + protected: virtual NSWindowStyleMask CalculateStyleMask() override; void UpdateStyle () override; diff --git a/native/Avalonia.Native/src/OSX/WindowImpl.mm b/native/Avalonia.Native/src/OSX/WindowImpl.mm index 840f2c9e88..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]; @@ -622,5 +626,5 @@ void WindowImpl::UpdateStyle() { [miniaturizeButton setHidden:!hasTrafficLights]; [miniaturizeButton setEnabled:_isEnabled]; [zoomButton setHidden:!hasTrafficLights]; - [zoomButton setEnabled:_isEnabled && _canResize]; + [zoomButton setEnabled:CanZoom()]; } diff --git a/packages/Avalonia/Avalonia.csproj b/packages/Avalonia/Avalonia.csproj index 1d210172f0..f21d6fefb4 100644 --- a/packages/Avalonia/Avalonia.csproj +++ b/packages/Avalonia/Avalonia.csproj @@ -43,6 +43,10 @@ true build\;buildTransitive\ + + true + build\;buildTransitive\ + true build\;buildTransitive\ diff --git a/packages/Avalonia/Avalonia.props b/packages/Avalonia/Avalonia.props index 26908b1081..2334aa91bc 100644 --- a/packages/Avalonia/Avalonia.props +++ b/packages/Avalonia/Avalonia.props @@ -6,6 +6,7 @@ false + diff --git a/readme.md b/readme.md index 2600cf83cc..c8135080fe 100644 --- a/readme.md +++ b/readme.md @@ -5,6 +5,10 @@
[![NuGet](https://img.shields.io/nuget/v/Avalonia.svg)](https://www.nuget.org/packages/Avalonia) [![downloads](https://img.shields.io/nuget/dt/avalonia)](https://www.nuget.org/packages/Avalonia) ![Size](https://img.shields.io/github/repo-size/avaloniaui/avalonia.svg) +# ⚠️ **v11 Update - Pausing community contributions** + +for more information see [this](https://github.com/AvaloniaUI/Avalonia/discussions/10599) discussion. + ## 📖 About Avalonia is a cross-platform UI framework for dotnet, providing a flexible styling system and supporting a wide range of Operating Systems such as Windows, Linux, macOS. Avalonia is mature and production ready. We also have in beta release support for iOS, Android and in early stages support for browser via WASM. diff --git a/samples/ControlCatalog.Android/Properties/AndroidManifest.xml b/samples/ControlCatalog.Android/Properties/AndroidManifest.xml index 6f551d2b01..ec07a94b22 100644 --- a/samples/ControlCatalog.Android/Properties/AndroidManifest.xml +++ b/samples/ControlCatalog.Android/Properties/AndroidManifest.xml @@ -2,4 +2,6 @@ + + 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}">