From c6bbcf7226a5fa5be6f20f50a3916c1f95eaebf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=9B=E5=B0=98=E7=A9=BA=E5=BF=A7?= Date: Sat, 11 Jan 2025 14:01:31 +0800 Subject: [PATCH] Modified the triggering method and parameter passing of the Command;changed`SelectedPath`to`SelectedPathsText`and supported two-way conversion with`SelectedPaths`;modified the parsing method of`FileFilter`so that it can override the`Name`parameter of the`FilePickerFileType`constructor and can define multiple`FilePickerFileType`instances;added support for`FilePickerFileTypes`in`FileFilter`;and added a new PathPicker style`PathPickerForMultipleText`. --- demo/Ursa.Demo/Pages/PathPickerDemo.axaml | 27 +- .../Controls/PathPicker.axaml | 32 ++- src/Ursa/Controls/PathPicker/PathPicker.cs | 234 +++++++++++------- 3 files changed, 196 insertions(+), 97 deletions(-) diff --git a/demo/Ursa.Demo/Pages/PathPickerDemo.axaml b/demo/Ursa.Demo/Pages/PathPickerDemo.axaml index b244907..933a7b3 100644 --- a/demo/Ursa.Demo/Pages/PathPickerDemo.axaml +++ b/demo/Ursa.Demo/Pages/PathPickerDemo.axaml @@ -13,7 +13,7 @@ + Content="PathPicker aggregates a file selector and provides a Command property. The Command is triggered solely after opening the file selector and selecting a file, whereupon the Command receives an IReadOnlyList<string> parameter."> @@ -24,7 +24,7 @@ Watermark="D:\Win7 Help\win-x64"> + Watermark="[Name,Pattern] like this [123,*.exe,*.pdb] or [All][ImageAll][11,*.txt]"> @@ -46,7 +46,20 @@ DefaultFileExtension="{Binding #DefaultFileExtension.Text}" AllowMultiple="{Binding #AllowMultiple.IsChecked}" UsePickerType="{Binding #UsePickerType.Value}" - SelectedPath="{Binding Path,Mode=OneWayToSource}" + SelectedPathsText="{Binding Path,Mode=OneWayToSource}" + SelectedPaths="{Binding Paths,Mode=OneWayToSource}"> + + + + @@ -59,11 +72,11 @@ DefaultFileExtension="{Binding #DefaultFileExtension.Text}" AllowMultiple="{Binding #AllowMultiple.IsChecked}" UsePickerType="{Binding #UsePickerType.Value}" - SelectedPath="{Binding Path,Mode=OneWayToSource}" + SelectedPathsText="{Binding Path,Mode=OneWayToSource}" SelectedPaths="{Binding Paths,Mode=OneWayToSource}"> - + @@ -80,7 +93,7 @@ - + diff --git a/src/Ursa.Themes.Semi/Controls/PathPicker.axaml b/src/Ursa.Themes.Semi/Controls/PathPicker.axaml index 07a243a..5ff8c86 100644 --- a/src/Ursa.Themes.Semi/Controls/PathPicker.axaml +++ b/src/Ursa.Themes.Semi/Controls/PathPicker.axaml @@ -9,31 +9,50 @@ + Text="{TemplateBinding SelectedPathsText,Mode=TwoWay}"> + + + + + + + + + + + + + - +