Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MartinZikmund/960cc264882c44500e31cce9f855bba8 to your computer and use it in GitHub Desktop.
Save MartinZikmund/960cc264882c44500e31cce9f855bba8 to your computer and use it in GitHub Desktop.
private void RefreshDisplayInformation()
{
var info = DisplayInfo.GetForCurrentView();
var properties = new PropertyInformation[]
{
new PropertyInformation(nameof(DisplayInfo.AutoRotationPreferences), SafeGetValue(()=>DisplayInfo.AutoRotationPreferences)),
new PropertyInformation(nameof(info.CurrentOrientation), SafeGetValue(()=>info.CurrentOrientation)),
new PropertyInformation(nameof(info.NativeOrientation), SafeGetValue(()=>info.NativeOrientation)),
new PropertyInformation(nameof(info.ScreenHeightInRawPixels), SafeGetValue(()=>info.ScreenHeightInRawPixels)),
new PropertyInformation(nameof(info.ScreenWidthInRawPixels), SafeGetValue(()=>info.ScreenWidthInRawPixels)),
new PropertyInformation(nameof(info.LogicalDpi), SafeGetValue(()=>info.LogicalDpi)),
new PropertyInformation(nameof(info.DiagonalSizeInInches), SafeGetValue(()=>info.DiagonalSizeInInches)),
new PropertyInformation(nameof(info.RawPixelsPerViewPixel), SafeGetValue(()=>info.RawPixelsPerViewPixel)),
new PropertyInformation(nameof(info.RawDpiX), SafeGetValue(()=>info.RawDpiX)),
new PropertyInformation(nameof(info.RawDpiY), SafeGetValue(()=>info.RawDpiY)),
new PropertyInformation(nameof(info.ResolutionScale), SafeGetValue(()=>info.ResolutionScale)),
};
PropertyListView.ItemsSource = properties;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment