How to put a WPF app on the secondary monitor with different refresh rate?

Viewed 320

I want to start my WPF app on my secondary monitor with different refresh rate, the refresh rate of the first monitor is 60 Hz and the second monitor is 50 Hz, I used the following method to place my app on the second display:

public bool  PutToSecondaryMonitor()
{
    var secondaryScreen = System.Windows.Forms.Screen.AllScreens
            .Where(s => !s.Primary).FirstOrDefault();

    if (secondaryScreen != null)
    {
        var workingArea = secondaryScreen.WorkingArea;
        this.Left = workingArea.Left;
        this.Top = workingArea.Top;
        this.Width = workingArea.Width;
        this.Height = workingArea.Height;
        return true;
    }
    return false;
}

But my app frame rate is always 60 Hz. Please tell me how to put a WPF app on the secondary monitor with different refresh rate?

Edit: This is a sample project

NOTE: When I run my WPF app exe file manually on the second monitor, I expect its fps to be equals of the second monitors refresh rate, but it locks in to refresh rate of the first monitor.

0 Answers
Related