File tree Expand file tree Collapse file tree 3 files changed +11
-7
lines changed
Expand file tree Collapse file tree 3 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ public static DynamicDialog GetFor_ShortcutNotFound(string targetPath)
5555 return dialog ;
5656 }
5757
58- public static DynamicDialog GetFor_CreateItemDialog ( string itemType )
58+ public static DynamicDialog GetFor_CreateItemDialog ( string itemType , string ? itemName )
5959 {
6060 DynamicDialog ? dialog = null ;
6161 TextBox inputText = new ( )
@@ -95,13 +95,14 @@ public static DynamicDialog GetFor_CreateItemDialog(string itemType)
9595
9696 inputText . Loaded += ( s , e ) =>
9797 {
98- // dispatching to the ui thread fixes an issue where the primary dialog button would steal focus
99- _ = inputText . DispatcherQueue . EnqueueOrInvokeAsync ( ( ) =>
98+ // Dispatching to the UI thread fixes an issue where the primary dialog button would steal focus
99+ _ = inputText . DispatcherQueue . EnqueueOrInvokeAsync ( ( ) =>
100100 {
101- if ( itemType . Equals ( "Folder" , StringComparison . OrdinalIgnoreCase ) )
102- {
101+ // Prefill text box with default name #17942
102+ if ( itemType . Equals ( "Folder" , StringComparison . OrdinalIgnoreCase ) )
103103 inputText . Text = Strings . NewFolder . GetLocalizedResource ( ) ;
104- }
104+ else if ( itemName is not null )
105+ inputText . Text = string . Format ( Strings . CreateNewFile . GetLocalizedResource ( ) , itemName ) ;
105106
106107 inputText . Focus ( FocusState . Programmatic ) ;
107108 inputText . SelectAll ( ) ;
Original file line number Diff line number Diff line change @@ -107,7 +107,7 @@ public static async Task CreateFileFromDialogResultTypeAsync(AddItemDialogItemTy
107107 string ? userInput = null ;
108108 if ( itemType != AddItemDialogItemType . File || itemInfo ? . Command is null )
109109 {
110- DynamicDialog dialog = DynamicDialogFactory . GetFor_CreateItemDialog ( itemType . ToString ( ) . GetLocalizedResource ( ) . ToLower ( ) ) ;
110+ DynamicDialog dialog = DynamicDialogFactory . GetFor_CreateItemDialog ( itemType . ToString ( ) . GetLocalizedResource ( ) . ToLower ( ) , itemInfo ? . Name ) ;
111111 await dialog . TryShowAsync ( ) ; // Show rename dialog
112112
113113 if ( dialog . DynamicResult != DynamicDialogResult . Primary )
Original file line number Diff line number Diff line change 43474347 <data name =" OnlyInColumnsView" xml : space =" preserve" >
43484348 <value >Only in Columns View</value >
43494349 </data >
4350+ <data name =" CreateNewFile" xml : space =" preserve" >
4351+ <value >New {0}</value >
4352+ </data >
43504353</root >
You can’t perform that action at this time.
0 commit comments