Windows Phone Dev 8 更改 HyperlinkBut​​ton Image (NO SILVERLIGHT)

Posted

技术标签:

【中文标题】Windows Phone Dev 8 更改 HyperlinkBut​​ton Image (NO SILVERLIGHT)【英文标题】:Windows Phone Dev 8 change HyperlinkButton Image (NO SILVERLIGHT) 【发布时间】:2015-09-24 23:50:54 【问题描述】:

我正在创建一个应用程序,我在其中更改了我的 HyperlinkBut​​ton 图像,但它没有运行。

var brush = new ImageBrush();
brush.ImageSource = new BitmapImage(new Uri("/Pics/Test/1/1_10.png", UriKind.Relative));
MainButton.Background = brush; 

我将此代码放在点击事件方法中,但调试器在第二行之后进入此代码:

    #if DEBUG && !DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION
            UnhandledException += (sender, e) =>
            
                if (global::System.Diagnostics.Debugger.IsAttached) global::System.Diagnostics.Debugger.Break();
            ;
#endif

【问题讨论】:

将 ImageBrush 更改为 Image? 【参考方案1】:

我认为您可能会因为 URI 无效而遇到异常。在这里查看 URI 方案:https://msdn.microsoft.com/en-us/library/windows/apps/jj655406.aspx

另外,图片应该作为内容添加。

【讨论】:

以上是关于Windows Phone Dev 8 更改 HyperlinkBut​​ton Image (NO SILVERLIGHT)的主要内容,如果未能解决你的问题,请参考以下文章

如何在 Windows Phone 8 中更改数据透视表头模板

如何检查Windows Phone 8中的地图中心点是不是已更改

如何在 windows phone 8.1 应用程序中使用 MenuFlyout 更改动态生成按钮的内容

windows phone silverlight 8 app 系统托盘颜色变化

Windows Phone:PositionChanged 未触发 Windows 8

本机 Windows Phone 8 图像 API