我的通用Windows平台应用程序在我点击菜单项时崩溃。

huangapple go评论55阅读模式
英文:

My Universal Windows Platform Application crashs when I click menu items

问题

我使用FontIcon创建了我的菜单项图标,并在FontFamily部分中写入了'Segoe Fluent Icons',然后使用它。但当我点击菜单项时,我的应用程序崩溃。我从Microsoft的网站下载了'Segoe Fluent Icons'字体包并尝试了它,但当我重新启动电脑时,同样的问题再次发生。

我的菜单项代码:

<muxc:MenuBar>
     <muxc:MenuBarItem Title="Example">
          <MenuFlyoutItem Text="Item1">
               <MenuFlyoutItem.Icon>
                     <FontIcon Glyph="&#xF6FA" FontFamily="Segoe Fluent Icons"/>
               </MenuFlyoutItem.Icon>
          </MenuFlyoutItem>
     </muxc:MenuBarItem>
</muxc:MenuBar>
英文:

I made the Icons of my menu Items using FontIcon and I write 'Segoe Fluent Icons' In the FontFamily section and use It. But when I click on my menu Items, my app crashes. I downloaded the 'Segoe Fluent Icons' font package from Microsoft's site and tried It, but when I restart my PC, the same problem happens again.

My Menu Items Code:

&lt;muxc:MenuBar&gt;
     &lt;muxc:MenuBarItem Title=&quot;Example&quot;&gt;
          &lt;MenuFlyoutItem Text=&quot;Item1&quot;&gt;
               &lt;MenuFlyoutItem.Icon&gt;
                     &lt;FontIcon Glyph=&quot;&amp;#xF6FA&quot; FontFamily=&quot;Segoe Fluent Icons&quot;/&gt;
               &lt;/MenuFlyoutItem.Icon&gt;
          &lt;/MenuFlyoutItem&gt;
     &lt;/muxc:MenuBarItem&gt;
&lt;/muxc:MenuBar&gt;

答案1

得分: 1

我尝试了你的代码,似乎你在Glyph属性的值后缺少了一个分号。在添加了它之后,代码可以正确运行,图标将会显示。

代码如下:

&lt;MenuFlyoutItem.Icon&gt;
    &lt;FontIcon Glyph=&quot;&amp;#xF6FA;&quot; FontFamily=&quot;Segoe Fluent Icons&quot;/&gt;
&lt;/MenuFlyoutItem.Icon&gt;

结果:
我的通用Windows平台应用程序在我点击菜单项时崩溃。

英文:

I tried your code, it seems that you are missing a semicolon for the value of Glyph property. After adding it, the code could run correctly and the Icon will show.

Code here:

                &lt;MenuFlyoutItem.Icon&gt;
                    &lt;FontIcon Glyph=&quot;&amp;#xF6FA;&quot; FontFamily=&quot;Segoe Fluent Icons&quot;/&gt;
                &lt;/MenuFlyoutItem.Icon&gt;

Result:
我的通用Windows平台应用程序在我点击菜单项时崩溃。

huangapple
  • 本文由 发表于 2023年2月19日 19:47:04
  • 转载请务必保留本文链接:https://go.coder-hub.com/75499911.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定