Example #1
0
        static void RescaleForDpi(Window window)
        {
            if (window != null)
            {
                var child = VisualTreeHelper.GetChild(window, 0) as FrameworkElement;
                if (child != null)
                {
                    ScaleElement(child, GetWindowDpiScale(window), true);
                }

                var dpiArgs = new DpiChangeEventArgs(window, GetWindowDpi(window), GetWindowDpiScale(window));
                window.RaiseEvent(dpiArgs);
            }
        }
 private void Window_DpiChange(object sender, ModernWpf.DpiChangeEventArgs e)
 {
     Debug.WriteLine("DPI changed to " + e.NewDpi);
 }