Introduction
Frame rate counter is a set of a few numeric values, which is displayed under the title bar, when the app runs in debug mode. But when this runs in “Release Mode”, it’s not visible in the screen. This is the default behavior of the app, which you are executing. It will not display, when someone installs the app from the store and runs it; unless you specifically asked it to display all the time.
Prerequisites
Now, let's get started with the steps, given below.
Step 1
Create Windows Universal Project
Open Visual Studio 2015 and click File -> New -> Project option for New Universal app.
Step 2 Giving the Project Name
New Project Window will open, there you can select an Installed -> Template -> Visual C# -> Windows -> Universal and select a Blank app (Universal Windows).
Type Project Name FrameCounter and click OK button.
Step 3 Setting the platform Versions
Here, we choose the Target version and Minimum version for our Universal Windows Application and click OK button.
Step 4 Choose Designer Window
Now, we go to Solution Explorer and select MainPage.xaml.
Step 5 Add the Coding
The code for the frame rate counter in debug mode is found in the App.xaml.cs class file. Open the file and go to OnLaunched event. There, you will find the code, given below.
this.DebugSettings.EnableFrameRateCounter is set as “true”.
- #if DEBUG
- if (System.Diagnostics.Debugger.IsAttached)
- {
- this.DebugSettings.EnableFrameRateCounter = true;
- }
- #endif
Now, we run our project. Thus, click the local machine to run the Application.
Output
If you want to remove the counter, you change the property to “false”, given in the code, below. this.DebugSettings.EnableFrameRateCounter is set as “false”.
- #if DEBUG
- if (System.Diagnostics.Debugger.IsAttached)
- {
- this.DebugSettings.EnableFrameRateCounter = false;
- }#endif
Now, we run our project. Thus, click the local machine to run the Application.
Output
Conclusion
I hope, you understood frame rate counter in Universal Window and how to run it.