How to get display name in Windows Store app
  • 2261

GetDisplayNameAsync method gets the display name for the user account.

GetFirstNameAsync method gets the user's first name.

GetLastNameAsync method gets the user's last name.

GetPrincipalNameAsync method gets the principal name for the user.

The following code snippet demonstrates how to get user's name.

// Get display name
string displayName = await Windows.System.UserProfile.UserInformation.GetDisplayNameAsync();
UserTextBox.Text = displayName; 

// Get first name, last name and domain  name
string firstName = await Windows.System.UserProfile.UserInformation.GetFirstNameAsync();
string lastName = await Windows.System.UserProfile.UserInformation.GetLastNameAsync();
string domainName = await Windows.System.UserProfile.UserInformation.GetDomainNameAsync();

See Complete Article here >


More Articles

© 2020 DotNetHeaven. All rights reserved.