Search code examples
c#wpfwindowstextuwp

Get Windows 10 Text Scaling value in WPF


How can I programmatically retrieve text scaling value of Windows in WPF?

enter image description here


Solution

  • Windows 10

    I've found a way to retrieve the Text Scaling Factor, without installing any Nuget packages. The idea is to obtain the value directly from the registry.

    var userKey = Microsoft.Win32.Registry.CurrentUser;
    var softKey = userKey.OpenSubKey("Software");
    var micKey = softKey.OpenSubKey("Microsoft");
    var accKey = micKey.OpenSubKey("Accessibility");
    
    var factor = accKey.GetValue("TextScaleFactor");`