图像不适用于Windows 8应用程序 [英] image not apperaring in windows 8 app

查看:85
本文介绍了图像不适用于Windows 8应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个图片代码我不知道图片没有出现的原因: 

I  have this image code i dont know why the image does not appear: 

        private ImageSource _image = null;

        private ImageSource _image = null;

        private String _imagePath = null;

        private string imagePath;

        public ImageSource图片

        {

           得到
            {

                if(this._image == null&& this._imagePath!= null)

                {

                    this._image = new BitmapImage(new Uri(SampleDataCommon._baseUri,this._imagePath));

                }¥b $ b                return this._image;

            }




           设为

            {

                this._imagePath = null;

                this.SetProperty(ref this._image,value);

            }¥b $ b        }




        public void SetImage(String path)

        {

            this._image = null;

            this._imagePath = path;

            this.OnPropertyChanged(" Image");

        }¥b $ b    }

        private String _imagePath = null;
        private string imagePath;
        public ImageSource Image
        {
            get
            {
                if (this._image == null && this._imagePath != null)
                {
                    this._image = new BitmapImage(new Uri(SampleDataCommon._baseUri, this._imagePath));
                }
                return this._image;
            }


            set
            {
                this._imagePath = null;
                this.SetProperty(ref this._image, value);
            }
        }


        public void SetImage(String path)
        {
            this._image = null;
            this._imagePath = path;
            this.OnPropertyChanged("Image");
        }
    }

我放了图片是这段代码: 

And were i put the picture is this code : 

private ObservableCollection< SampleDataGroup> _itemGroups = new ObservableCollection< SampleDataGroup>();

  &NBSP; &NBSP; &NBSP; public ObservableCollection< SampleDataGroup>商品分组

  &NBSP; &NBSP; &NBSP; {

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; get {return this._itemGroups; }¥b $ b  &NBSP; &NBSP; &NBSP; }




  &NBSP; &NBSP; &NBSP; public SampleDataSource()

  &NBSP; &NBSP; &NBSP; {

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; String ITEM_CONTENT = String.Format(" Item Content:{0} \ n\\\
{0} \ n \ n {0} \ n \ n {0} \ n \ n {0 } \ n \\ n {0} \ n \ n {0}",

             "图片和应用");




  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; var group1 = new SampleDataGroup(" Group-1",&
          "标题#1",

          " Assets / darkblue.png",

private ObservableCollection<SampleDataGroup> _itemGroups = new ObservableCollection<SampleDataGroup>();
        public ObservableCollection<SampleDataGroup> ItemGroups
        {
            get { return this._itemGroups; }
        }


        public SampleDataSource()
        {
            String ITEM_CONTENT = String.Format("Item Content: {0}\n\n{0}\n\n{0}\n\n{0}\n\n{0}\n\n{0}\n\n{0}",
                        "Images and apps");


            var group1 = new SampleDataGroup("Group-1",
                    "Titles #1",
                    "Assets/darkblue.png",

我不知道什么是错的我希望你可以帮助我 

I dont know whats wrong i hope you can help me 

PD:即时通讯使用C#

PD: im using C#

推荐答案

您列出的代码都没有显示图像。创建一个BitmapImage,但不要做任何事情。你的Xaml是什么样的?这个类是什么?

None of the code you list displays an image. You create a BitmapImage, but don't do anything with it. What does your Xaml look like? What is this class?

通常你会放一个
图像
控制你的Xaml然后设置它的
来源
属性(在这种情况下,你的BitmapImage)你想要的se.

Typically you would place an Image control in your Xaml and then set its Source property to the ImageSource (in this case your BitmapImage) you want to use.

看一看在
Xaml图像样本
中获取示例。

- Rob


这篇关于图像不适用于Windows 8应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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