mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 18:57:19 +02:00
CmdPal: Auto-focus first content (#39414)
This lets us auto-focus the first input on a `IFormContent`, if there's only one `IContent` on the page. This dramatically improves the usability for forms, since we'll immediately put focus into them Closes #38436
This commit is contained in:
@@ -79,6 +79,9 @@ public partial class ContentPageViewModel : PageViewModel, ICommandBarContext
|
||||
throw;
|
||||
}
|
||||
|
||||
var oneContent = newContent.Count == 1;
|
||||
newContent.ForEach(c => c.OnlyControlOnPage = oneContent);
|
||||
|
||||
// Now, back to a UI thread to update the observable collection
|
||||
DoOnUiThread(
|
||||
() =>
|
||||
|
||||
@@ -7,4 +7,5 @@ namespace Microsoft.CmdPal.UI.ViewModels;
|
||||
public abstract partial class ContentViewModel(WeakReference<IPageContext> context) :
|
||||
ExtensionObjectViewModel(context)
|
||||
{
|
||||
public bool OnlyControlOnPage { get; internal set; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user