Windows 10中的通知(winrt + desktop)不工作子组

时间:2016-06-11 18:17:34

标签: c# notifications windows-runtime

我尝试从桌面应用程序显示Toast(而不是tile)通知。 (C#) 没有组都可以,我看到文本和图像,但组(子组)隐藏。 为什么呢?

我通过NotificationsExtensions.Win10创建xml 如果需要我会发布原始xml。 感谢。

`

<?xml version="1.0" encoding="utf-8"?>
<toast launch="https://toster.ru/q/327775?e=3995419#comment_1108015">
  <visual>
    <binding template="ToastGeneric">
      <text>Today will be mostly sunny with a high of 63 and a low of 42.</text>
      <group>
        <subgroup hint-weight="1">
          <text hint-align="center">Mon</text>
          <image src="file:///C:/Users/user/documents/visual studio 2015/Projects/android.forms.test/Lobster.Home.Toster.ru.Windows/bin/Debug/images/icon_activity_comment.png" hint-removeMargin="true" />
          <text hint-align="center">63°</text>
          <text hint-align="center" hint-style="captionSubtle">42°</text>
        </subgroup>
        <subgroup hint-weight="1">
          <text hint-align="center">Tue</text>
          <image src="file:///C:/Users/user/documents/visual studio 2015/Projects/android.forms.test/Lobster.Home.Toster.ru.Windows/bin/Debug/images/icon_activity_comment.png" hint-removeMargin="true" />
          <text hint-align="center">57°</text>
          <text hint-align="center" hint-style="captionSubtle">38°</text>
        </subgroup>
        <subgroup hint-weight="1">
          <text hint-align="center">Wed</text>
          <image src="file:///C:/Users/user/documents/visual studio 2015/Projects/android.forms.test/Lobster.Home.Toster.ru.Windows/bin/Debug/images/icon_activity_comment.png" hint-removeMargin="true" />
          <text hint-align="center">59°</text>
          <text hint-align="center" hint-style="captionSubtle">43°</text>
        </subgroup>
        <subgroup hint-weight="1">
          <text hint-align="center">Thu</text>
          <image src="file:///C:/Users/user/documents/visual studio 2015/Projects/android.forms.test/Lobster.Home.Toster.ru.Windows/bin/Debug/images/icon_activity_comment.png" hint-removeMargin="true" />
          <text hint-align="center">62°</text>
          <text hint-align="center" hint-style="captionSubtle">42°</text>
        </subgroup>
        <subgroup hint-weight="1">
          <text hint-align="center">Fri</text>
          <image src="file:///C:/Users/user/documents/visual studio 2015/Projects/android.forms.test/Lobster.Home.Toster.ru.Windows/bin/Debug/images/icon_activity_comment.png" hint-removeMargin="true" />
          <text hint-align="center">71°</text>
          <text hint-align="center" hint-style="captionSubtle">66°</text>
        </subgroup>
      </group>
    </binding>
  </visual>
</toast>

`

1 个答案:

答案 0 :(得分:0)

你可以使用这个很棒的应用程序来测试你的Toasts并在你发送它之前看到它并设置XML数据: Notifications Visualizer - Windows Store

对于您的问题,我认为这是一个常见问题,如果您错过了结束标记或视觉效果的xml代码顺序不正确,解决方案是使用Notifications Visualizer应用程序。

更新1:

由于您无法下载该应用,所以这里使用的是他们使用的XML代码。我在自己的机器上试过它并且看起来不错:

Weather Toast

<toast>

    <visual baseUri="Assets/Apps/Weather/">
        <binding template="ToastGeneric">
            <text>Today will be sunny with a high of 63 and a low of 42.</text>

            <group>
                <subgroup hint-weight="1">
                    <text hint-align="center">Mon</text>
                    <image src="Mostly Cloudy.png" hint-removeMargin="true"/>
                    <text hint-align="center">63°</text>
                    <text hint-style="captionsubtle" hint-align="center">42°</text>
                </subgroup>
                <subgroup hint-weight="1">
                    <text hint-align="center">Tue</text>
                    <image src="Cloudy.png" hint-removeMargin="true"/>
                    <text hint-align="center">57°</text>
                    <text hint-style="captionsubtle" hint-align="center">38°</text>
                </subgroup>
                <subgroup hint-weight="1">
                    <text hint-align="center">Wed</text>
                    <image src="Sunny.png" hint-removeMargin="true"/>
                    <text hint-align="center">59°</text>
                    <text hint-style="captionsubtle" hint-align="center">43°</text>
                </subgroup>
                <subgroup hint-weight="1">
                    <text hint-align="center">Thu</text>
                    <image src="Sunny.png" hint-removeMargin="true"/>
                    <text hint-align="center">62°</text>
                    <text hint-style="captionsubtle" hint-align="center">42°</text>
                </subgroup>
                <subgroup hint-weight="1">
                    <text hint-align="center">Fri</text>
                    <image src="Sunny.png" hint-removeMargin="true"/>
                    <text hint-align="center">71°</text>
                    <text hint-style="captionsubtle" hint-align="center">66°</text>
                </subgroup>
            </group>
        </binding>
    </visual>

</toast>

顺便说一句,我已经在Visualizer应用程序中尝试了你的xml代码,它什么都没显示! 尝试调整我提供的xml代码以满足您的需求......