简体   繁体   English

Windows Phone Dev 8更改HyperlinkBut​​ton图像(无SILVERLIGHT)

[英]Windows Phone Dev 8 change HyperlinkButton Image (NO SILVERLIGHT)

I'm making an Application where I change my HyperlinkButton image but it doesn't go. 我正在制作一个应用程序,在其中更改我的HyperlinkBut​​ton图像,但它没有成功。

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

I put this code in the click event method but the Debugger goes after the second Line to this code: 我将此代码放在click事件方法中,但调试器在此代码的第二行之后:

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

I think you might be getting an exception because of an invalid URI. 我认为您可能是因为无效的URI而导致异常。 Take a look at URI schemes here: https://msdn.microsoft.com/en-us/library/windows/apps/jj655406.aspx 在这里查看URI方案: https : //msdn.microsoft.com/zh-cn/library/windows/apps/jj655406.aspx

Also, the image should be added as Content. 另外,图像应作为内容添加。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将Windows Phone HyperlinkBut​​ton导航移植到Windows 8 HyperlinkBut​​ton导航 - Porting Windows Phone HyperlinkButton Navigation To Windows 8 HyperlinkButton Navigation 无法将命令绑定到超链接按钮 (Windows Phone 8.1) - Unable to bind a Command to a HyperlinkButton (Windows Phone 8.1) 绑定HyperlinkBut​​ton Windows Phone 8的NavigateUri属性 - Bind NavigateUri property of HyperlinkButton Windows Phone 8 将图像分成几块Silverlight Windows Phone - Split an image into several pieces silverlight windows phone 创建HyperlinkBut​​ton,并在其后的代码中包含文字换行(Windows Phone 8) - Create HyperlinkButton with text wrapping in code behind (Windows Phone 8) 如何使用HyperlinkBut​​ton在Windows Phone 8.1中显示ContentDialog页面 - How to use HyperlinkButton to show ContentDialog page in Windows Phone 8.1 Windows Phone(Silverlight)上的NCalc - NCalc on Windows Phone (Silverlight) Windows Phone Silverlight中的NavigationService - NavigationService in Windows Phone Silverlight 更改进度指示器中点的颜色Windows Phone Silverlight 8.1 - Change color of the dots in progress indicator Windows Phone Silverlight 8.1 在Windows Phone 8.1 Silverlight应用程序中更改应用程序根框架 - Change app root frame in Windows Phone 8.1 Silverlight application
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM