@@ -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,14 +95,24 @@ 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 ( ( ) => inputText . Focus ( FocusState . Programmatic ) ) ;
98+ // Dispatching to the UI thread fixes an issue where the primary dialog button would steal focus
99+ _ = inputText . DispatcherQueue . EnqueueOrInvokeAsync ( ( ) =>
100+ {
101+ // Prefill text box with default name #17845
102+ if ( itemType . Equals ( "Folder" , StringComparison . OrdinalIgnoreCase ) )
103+ inputText . Text = Strings . NewFolder . GetLocalizedResource ( ) ;
104+ else if ( itemName is not null )
105+ inputText . Text = string . Format ( Strings . CreateNewFile . GetLocalizedResource ( ) , itemName ) ;
106+
107+ inputText . Focus ( FocusState . Programmatic ) ;
108+ inputText . SelectAll ( ) ;
109+ } ) ;
100110 } ;
101111
102112 dialog = new DynamicDialog ( new DynamicDialogViewModel ( )
103113 {
104114 TitleText = string . Format ( Strings . CreateNewItemTitle . GetLocalizedResource ( ) , itemType ) ,
105- SubtitleText = null ,
115+ SubtitleText = Strings . EnterAnItemName . GetLocalizedResource ( ) ,
106116 DisplayControl = new Grid ( )
107117 {
108118 MinWidth = 300d ,
0 commit comments