Change display name of subview in cordova windows platform

  • 9 months ago
Comment

ChatGPT
1 / 1

In Cordova, if you want to change the display name of a subview on the Windows platform (UWP), you need to modify the app's manifest file. The display name is typically shown in the app's title bar and other places where the app's name is displayed. Here's how you can do it:

  1. Modify config.xml:
    Open your app's config.xml file, which is located at the root of your Cordova project.

  2. Add Platform-Specific Configuration:
    To make platform-specific configurations, you'll use the <platform> element. In this case, we're focusing on the Windows (UWP) platform.

    xml
    <platform name="windows">
    <!-- Add configuration specific to the Windows platform here -->
    </platform>
  3. Change the Display Name:
    Within the <platform> element for Windows, add the DisplayName preference to specify the new display name for the app. You can set this preference to the desired value.

    xml
    <platform name="windows">
    <preference name="DisplayName" value="New Display Name" />
    </platform>
  4. Update the App Icon and Tile Name (Optional):
    If you also want to change the app's icon and the name displayed on the app tile in the Start Menu, you can use the WindowsSquare150x150Logo and WindowsSquare44x44Logo preferences along with the WindowsPhoneStoreIdentityName preference.

    xml
    <platform name="windows">
    <preference name="DisplayName" value="New Display Name" />
    <preference name="WindowsSquare150x150Logo" value="www/images/logo150x150.png" />
    <preference name="WindowsSquare44x44Logo" value="www/images/logo44x44.png" />
    <preference name="WindowsPhoneStoreIdentityName" value="NewDisplayName" />
    </platform>
  5. Build and Deploy:
    After making these changes, save the config.xml file and rebuild your Cordova project for the Windows platform using the appropriate commands (e.g., cordova build windows). Deploy the app to a Windows device or emulator to see the changes in effect.

Remember that changing the display name might also affect other aspects of your app, such as its identity and how it's recognized on the Windows Store. Always ensure that you're adhering to any naming guidelines and considering the impact of changing the display name on user experience and branding.