how to Get Windows Username in WPF

wpf

Solution

System.Security.Principal.WindowsIdentity.GetCurrent().Name

I also found:

Environment.UserName

or

System.Windows.Forms.SystemInformation.UserName

I cannot try it so check for yourself the result.

Added: Full user name:

Imports System.DirectoryServices.AccountManagement

Dim userFullName As String = UserPrincipal.Current.DisplayName

Problem

I would like to display the Username in my WPF application, where it should get the username from the current user logged in? so my question how can we get the username of windows logged in user from WPF App ?

Original source