在WP8中将图像添加到WPToolkit自定义MessageBox [英] Adding an Image to WPToolkit custom MessageBox in WP8

查看:73
本文介绍了在WP8中将图像添加到WPToolkit自定义MessageBox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以将图像作为内容添加到Toolkit自定义messageBox?

,因为我尝试过它没有用,Messagebox是空的。

以下是我的尝试:

图片图片= 图片(); 
image.Height = 250 ;
image.Width = 300 ;
image.VerticalAlignment = System.Windows.VerticalAlignment.Center;
image.Horizo​​ntalAlignment = System.Windows.Horizo​​ntalAlignment.Center;
image.Margin = new 厚度( 0 12 0 12 );
image.Source = new BitmapImage(){UriSource = new Uri( @ / Assets / AppBar / AddToCart.png)};
CustomMessageBox dialogBox = new CustomMessageBox()
{
Title = 添加到购物车?
FontSize = 38
FontWeight = FontWeights .Thin,
Margin = new 厚度( 0 0 0 0 ),
Content = image,
LeftButtonContent =
RightButtonContent = 取消
};

解决方案

我们现在可以告诉你出了什么问题。



您必须单步执行代码并找出创建BitmapImage()对象时未加载资源的原因。如果你把那行划分为它自己的变量可能会有所帮助,所以你可以在它上面设置一个断点并检查它抛出的值和任何错误信息。



认真地说,关于我已经尝试过一切我做错了什么?的部分。是胡说八道,因为你没有尝试过所有的东西,而你所犯的错误与代码无关,而是与你的调试技巧有关。


我使用过:

 image.Source =  new  BitmapImage( new  Uri(< span class =code-string> @  Assets / AppBar / AddToCart.png,UriKind.RelativeOrAbsolute))



感谢大家的建议,并花时间评论上帝保佑你..



快乐编码.. :) / BLOCKQUOTE>

is it Possible to Add an image to the Toolkit custom messageBox as Content?
because i tried and it didnt work, the Messagebox is Blank.
Here is what i have tried:

Image image = new Image();
            image.Height = 250;
            image.Width = 300;
            image.VerticalAlignment = System.Windows.VerticalAlignment.Center;
            image.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
            image.Margin = new Thickness(0, 12, 0, 12);
            image.Source = new BitmapImage() { UriSource = new Uri(@"/Assets/AppBar/AddToCart.png") };
            CustomMessageBox dialogBox = new CustomMessageBox()
            {
                Title = "Add to cart?",
                FontSize = 38,
                FontWeight = FontWeights.Thin,
                Margin = new Thickness(0,0,0,0),
                Content = image,
                LeftButtonContent = "Yes",
                RightButtonContent = "Cancel",
            }; 

解决方案

There's now way for us to tell you what's wrong.

YOU have to step through the code and find out why the asset isn't being loaded by the creation of the BitmapImage() object. It would probably help if you broke that line out into it's own variable so you can set a breakpoint on it and examine the values and any error messages it throws.

Seriously, the part about "I have tried everything what am I doing wrong?" is bullshit because you have NOT tried everything and what you're doing wrong has nothing to do with the code but everything to do with your debugging skills.


i used:

image.Source = new BitmapImage(new Uri(@"Assets/AppBar/AddToCart.png",UriKind.RelativeOrAbsolute))


Thanks for the Suggestions to all of you and taking your time to comment God Bless you..

Happy Coding.. :)


这篇关于在WP8中将图像添加到WPToolkit自定义MessageBox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆