AccountsSettingsPane Class
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Provides methods to show the accounts pane and also to enable the app to register callbacks when the accounts flyout is about to be displayed.
public ref class AccountsSettingsPane sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.None)]
class AccountsSettingsPane final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.None)]
public sealed class AccountsSettingsPane
Public NotInheritable Class AccountsSettingsPane
- Inheritance
- Attributes
Device family |
Windows 10 (introduced in 10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
|
API contract |
Windows.Foundation.UniversalApiContract (introduced in v1.0)
|
The app provides the callbacks with account metadata for all of the web account providers, web accounts, global account commands, and credential locker credentials that the app displays. Examples of account providers are Facebook, LinkedIn, and Twitter.
The account and credential command classes in the Windows.UI.ApplicationSettings namespace correspond with data objects in the Windows.UI.ApplicationSettings namespace:
Data Object (Windows.Security.Credentials) | UI object (Windows.UI.ApplicationSettings) |
---|---|
WebAccount | WebAccountCommand |
WebAccountProvider | WebAccountProviderCommand |
PasswordCredential | CredentialCommand |
For a desktop app, instead of using the AccountSettingsPane class, you'll need to use the interop API as described below.
- First Retrieve a window handle (HWND). That topic contains code examples for Windows UI Library (WinUI) 3, Windows Presentation Foundation (WPF), and Windows Forms (WinForms). Plug that code into the code listing below.
- You should use the IAccountSettingsPaneInterop interface in your desktop app. For C# apps using .NET 6 or later, the AccountSettingsPaneInterop class is available. For more info about the C# interop classes, see Call interop APIs from a .NET 5+ app. Also see Display WinRT UI objects that depend on CoreWindow.
The following is an example on how to use the AccountSettingsPaneInterop class in C# (.NET 6 or later):
private void LoginButton_Click(object sender, RoutedEventArgs e)
{
// Retrieve the window handle for whichever UI framework being used (WinUI 3, WPF, WinForms)
var hwnd = ...
// Call methods from the interop class, passing in the window handle
await AccountsSettingsPaneInterop.ShowManageAccountsForWindowAsync(hwnd);
}
Windows version | SDK version | Value added |
---|---|---|
1607 | 14393 | ShowAddAccountAsync |
1607 | 14393 | ShowManageAccountsAsync |
1803 | 17134 | ShowAddAccountForUserAsync |
1803 | 17134 | ShowManageAccountsForUserAsync |
Get |
Gets an AccountsSettingsPane object that is associated with the current app view (that is, with CoreWindow). |
Show() |
Displays the account settings pane. |
Show |
Displays the add accounts screen. |
Show |
Displays the add accounts screen for the specified user. |
Show |
Displays the manage accounts screen. |
Show |
Displays the manage accounts screen for the specified user. |
Account |
Occurs when the user opens the accounts pane. Handling this event lets the app initialize the accounts commands and pause its UI until the user closes the pane. |