Adaptive Code And Custom Title Bar (Mobile) in Universal Windows Programs

Generally, Title Bar is not available in a Mobile application, this article explains about, how to add the custom Title Bar in Mobile & Desktop application.

Custom TitleBar

Steps

  1. Create the XAML template.

    TextBlock: Add the TitleBar of the Text.
    Button: Close button, placed to right side of the application.

    XAML

  2. Button event handler call Application and exit to close the application,

    Application

  3. Set the ExtendViewInfoTitleBar property to true, this property allow developer overwrite the TitleBar.

    property

  4. Pass XAML (stackpanel) control to the SetTitleBar function.

    control

Run the application

application1

Adaptive Code

What is Adaptive Code

Runs the code only specific device family is called Adaptive code.

The above application run all the platforms, developer want to run only the mobile device family, need to rewrite the code for mobile? No, check only one condition above code run only mobile application.

code

Check above API present running platform or not, if present application running in the mobile device.

ApiInformation.IsTypePresent function is used to check API present or not.

API

Add the control into the SetTitleBar function, if IsTypePresent condition is true,

SetTitleBar

Output in the MobileApplication,

Output

Run the Application in Full Screen mode

Set the ApplicationViewWindowingMode. FullScreen, application is running in full screen mode,

mode


Similar Articles