diff --git a/samples/ControlCatalog/ControlCatalog.csproj b/samples/ControlCatalog/ControlCatalog.csproj index 903c849834..8358fb3cd4 100644 --- a/samples/ControlCatalog/ControlCatalog.csproj +++ b/samples/ControlCatalog/ControlCatalog.csproj @@ -1,6 +1,6 @@  - netstandard2.0 + netstandard2.0;net6.0 true enable diff --git a/samples/ControlCatalog/MainView.xaml b/samples/ControlCatalog/MainView.xaml index d8dc3bad2d..b6ce59f15b 100644 --- a/samples/ControlCatalog/MainView.xaml +++ b/samples/ControlCatalog/MainView.xaml @@ -69,6 +69,9 @@ + + + diff --git a/samples/ControlCatalog/MainView.xaml.cs b/samples/ControlCatalog/MainView.xaml.cs index d675324d9f..47d11738bc 100644 --- a/samples/ControlCatalog/MainView.xaml.cs +++ b/samples/ControlCatalog/MainView.xaml.cs @@ -24,11 +24,6 @@ namespace ControlCatalog { IList tabItems = ((IList)sideBar.Items); tabItems.Add(new TabItem() - { - Header = "Dialogs", - Content = new DialogsPage() - }); - tabItems.Add(new TabItem() { Header = "Screens", Content = new ScreenPage() diff --git a/samples/ControlCatalog/Pages/DialogsPage.xaml b/samples/ControlCatalog/Pages/DialogsPage.xaml index 8a835867b3..cc23ef796a 100644 --- a/samples/ControlCatalog/Pages/DialogsPage.xaml +++ b/samples/ControlCatalog/Pages/DialogsPage.xaml @@ -1,29 +1,57 @@ - - - Use filters - - - - - + + - - + - - - - - - - + + + + + + + + + + + + + + Use filters + + + Force managed dialog + Open multiple + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/ControlCatalog/Pages/DialogsPage.xaml.cs b/samples/ControlCatalog/Pages/DialogsPage.xaml.cs index efa30c2741..f7b6db1255 100644 --- a/samples/ControlCatalog/Pages/DialogsPage.xaml.cs +++ b/samples/ControlCatalog/Pages/DialogsPage.xaml.cs @@ -1,13 +1,21 @@ using System; +using System.Buffers; using System.Collections.Generic; using System.Linq; using System.Reflection; +using System.Threading.Tasks; +using Avalonia; using Avalonia.Controls; using Avalonia.Controls.Presenters; using Avalonia.Dialogs; using Avalonia.Layout; using Avalonia.Markup.Xaml; -#pragma warning disable 4014 +using Avalonia.Platform.Storage; +using Avalonia.Platform.Storage.FileIO; + +#pragma warning disable CS0618 // Type or member is obsolete +#nullable enable + namespace ControlCatalog.Pages { public class DialogsPage : UserControl @@ -18,13 +26,16 @@ namespace ControlCatalog.Pages var results = this.Get("PickerLastResults"); var resultsVisible = this.Get("PickerLastResultsVisible"); + var bookmarkContainer = this.Get("BookmarkContainer"); + var openedFileContent = this.Get("OpenedFileContent"); + var openMultiple = this.Get("OpenMultiple"); - string? lastSelectedDirectory = null; + IStorageFolder? lastSelectedDirectory = null; - List? GetFilters() + List GetFilters() { if (this.Get("UseFilters").IsChecked != true) - return null; + return new List(); return new List { new FileDialogFilter @@ -39,12 +50,23 @@ namespace ControlCatalog.Pages }; } + List? GetFileTypes() + { + if (this.Get("UseFilters").IsChecked != true) + return null; + return new List + { + FilePickerFileTypes.All, + FilePickerFileTypes.TextPlain + }; + } + this.Get