I'm writing an application using C#/WPF and I'm trying to get DPI of a screen. I'm trying to do it this way:
Window MainWindow = Application.Current.MainWindow;
PresentationSource MainWindowPresentationSource = PresentationSource.FromVisual(MainWindow);
Matrix m = MainWindowPresentationSource.CompositionTarget.TransformToDevice;
MessageBox.Show(m.M11.ToString());
But what I get printing m.M11 is always 1. Why is that and how can I get the actual DPI (that is 96, as I suppose)?