How to create a system notification with ultra long ellipses displayed

Thomas Zuo 25 Reputation points
2024-05-28T01:37:25.9666667+00:00

Hi

I want to display all the text on the system notification, but extra long text shows ellipses. Also need to use line breaks to wrap the displayed text.

The code is placed in the following link, and the commented out lines 133 and 134 are the desired system notification effects.

DesktopToasts's MainWindow.xaml.cs

The following is the content of the XML for setting notifications.

<toast>
    <visual>
        <binding template="ToastText04">
            <text id="1">Title0123456</text>
            <text id="2" hintMaxLines="1" TextWrapping="NoWrap">Add text without wrap1.Add text without wrap2.Add text without wrap3.\nAdd text without wrap4.Add text without wrap5.Add text without wrap6.</text>
            <text id="3" hintMaxLines="1">The third line.Add text without wrap1 third line1.Add text without wrap2 third line2.\nAdd text without wrap3 third line3.</text>
        </binding>
    </visual>
</toast>

The system notification displays as follows:

enter image description here

The third line is not displayed

I want the system notification to display as shown in the following image

enter image description here

How should I construct XML to achieve system notification display like this?

Windows
Windows
A family of Microsoft operating systems that run across personal computers, tablets, laptops, phones, internet of things devices, self-contained mixed reality headsets, large collaboration screens, and other devices.
5,493 questions
Windows App SDK
Windows App SDK
A set of Microsoft open-source libraries, frameworks, components, and tools to be used in apps to access Windows platform functionality on many versions of Windows. Previously known as Project Reunion.
794 questions
0 comments No comments
{count} votes

Accepted answer
  1. Xiaopo Yang - MSFT 12,726 Reputation points Microsoft Vendor
    2024-05-28T07:03:11.2366667+00:00

    According to Toast content schema Text elements:

    Since the Windows 10 Anniversary Update, you can control how many lines of text are displayed by using the HintMaxLines property on the text. The default (and maximum) is up to 2 lines of text for the title, and up to 4 lines (combined) for the two additional description elements (the second and third AdaptiveText).

    And AppNotificationBuilder.AddText Method:

    A maximum of three text elements can be added to an app notification.

    And according to my test, the notification UI shows characters ending with a \n as a text element. User's image So, your desired notification needs five text elements actually while A maximum of three text elements can be added to an app notification.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.