C# 从Uri显示图像

C# 从Uri显示图像,c#,windows-phone-8,windows-phone,uri,C#,Windows Phone 8,Windows Phone,Uri,在Windows Phone 8应用程序中,我使用以下代码显示图像: InitializeComponent(); Image i = new Image(); i.Source = new BitmapImage(new Uri("C:\\Data\\Users\\Public\\Pictures\\Sample Pictures\\sample_photo_05.jpg", UriKind.RelativeOrAbsolute)); LayoutRoot.Children.Ad

在Windows Phone 8应用程序中,我使用以下代码显示图像:

InitializeComponent();
Image i = new Image();
i.Source = new BitmapImage(new Uri("C:\\Data\\Users\\Public\\Pictures\\Sample Pictures\\sample_photo_05.jpg", UriKind.RelativeOrAbsolute));       
LayoutRoot.Children.Add(i);

但是当页面加载时,屏幕是空的。有人知道我做错了什么吗?

按照以下步骤在windows phone中按URI设置图像 1.在解决方案的“图像”文件夹中复制图像。 2.将图像设置为资源右键单击图像->属性->构建操作==内容

InitializeComponent();
Image i = new Image();
i.Height =100;
i.Width=100;
i.Source = new BitmapImage(new Uri("/Images/YourImageName", UriKind.RelativeOrAbsolute));       
 LayoutRoot.Children.Add(i);

按照以下步骤在windows phone中按URI设置图像 1.在解决方案的“图像”文件夹中复制图像。 2.将图像设置为资源右键单击图像->属性->构建操作==内容

InitializeComponent();
Image i = new Image();
i.Height =100;
i.Width=100;
i.Source = new BitmapImage(new Uri("/Images/YourImageName", UriKind.RelativeOrAbsolute));       
 LayoutRoot.Children.Add(i);

按照以下步骤在windows phone中按URI设置图像 1.在解决方案的“图像”文件夹中复制图像。 2.将图像设置为资源右键单击图像->属性->构建操作==内容

InitializeComponent();
Image i = new Image();
i.Height =100;
i.Width=100;
i.Source = new BitmapImage(new Uri("/Images/YourImageName", UriKind.RelativeOrAbsolute));       
 LayoutRoot.Children.Add(i);

按照以下步骤在windows phone中按URI设置图像 1.在解决方案的“图像”文件夹中复制图像。 2.将图像设置为资源右键单击图像->属性->构建操作==内容

InitializeComponent();
Image i = new Image();
i.Height =100;
i.Width=100;
i.Source = new BitmapImage(new Uri("/Images/YourImageName", UriKind.RelativeOrAbsolute));       
 LayoutRoot.Children.Add(i);

复制资产文件夹中的图像,并设置生成操作==内容

InitializeComponent();
Image i = new Image();
i.Height =100;
i.Width=100;
i.Source = new BitmapImage(new Uri("/Images/YourImageName", UriKind.RelativeOrAbsolute));       
 LayoutRoot.Children.Add(i);
Image i = new Image();
i.Source = new BitmapImage(new Uri("/yourProjectName;component/Assets/YourImageName", UriKind.RelativeOrAbsolute));       
LayoutRoot.Children.Add(i);
// draw an image, set relative source (in project) and add to LayoutRoot.
var i = new Image{
Source = new BitmapImage(
new Uri("/project;component/Images/image.jpg", UriKind.Relative))
};       
LayoutRoot.Children.Add(i);

复制资产文件夹中的图像,并设置生成操作==内容

InitializeComponent();
Image i = new Image();
i.Height =100;
i.Width=100;
i.Source = new BitmapImage(new Uri("/Images/YourImageName", UriKind.RelativeOrAbsolute));       
 LayoutRoot.Children.Add(i);
Image i = new Image();
i.Source = new BitmapImage(new Uri("/yourProjectName;component/Assets/YourImageName", UriKind.RelativeOrAbsolute));       
LayoutRoot.Children.Add(i);
// draw an image, set relative source (in project) and add to LayoutRoot.
var i = new Image{
Source = new BitmapImage(
new Uri("/project;component/Images/image.jpg", UriKind.Relative))
};       
LayoutRoot.Children.Add(i);

复制资产文件夹中的图像,并设置生成操作==内容

InitializeComponent();
Image i = new Image();
i.Height =100;
i.Width=100;
i.Source = new BitmapImage(new Uri("/Images/YourImageName", UriKind.RelativeOrAbsolute));       
 LayoutRoot.Children.Add(i);
Image i = new Image();
i.Source = new BitmapImage(new Uri("/yourProjectName;component/Assets/YourImageName", UriKind.RelativeOrAbsolute));       
LayoutRoot.Children.Add(i);
// draw an image, set relative source (in project) and add to LayoutRoot.
var i = new Image{
Source = new BitmapImage(
new Uri("/project;component/Images/image.jpg", UriKind.Relative))
};       
LayoutRoot.Children.Add(i);

复制资产文件夹中的图像,并设置生成操作==内容

InitializeComponent();
Image i = new Image();
i.Height =100;
i.Width=100;
i.Source = new BitmapImage(new Uri("/Images/YourImageName", UriKind.RelativeOrAbsolute));       
 LayoutRoot.Children.Add(i);
Image i = new Image();
i.Source = new BitmapImage(new Uri("/yourProjectName;component/Assets/YourImageName", UriKind.RelativeOrAbsolute));       
LayoutRoot.Children.Add(i);
// draw an image, set relative source (in project) and add to LayoutRoot.
var i = new Image{
Source = new BitmapImage(
new Uri("/project;component/Images/image.jpg", UriKind.Relative))
};       
LayoutRoot.Children.Add(i);

使用CameraCaptureTask,可能是这样

初始化CameraCaptureTask对象

 CameraCaptureTask cameracapturetask = new CameraCaptureTask();
                    cameracapturetask.Completed += new EventHandler<PhotoResult>(cameracapturetask_Completed);
                    cameracapturetask.Show();

使用CameraCaptureTask,可能是这样

初始化CameraCaptureTask对象

 CameraCaptureTask cameracapturetask = new CameraCaptureTask();
                    cameracapturetask.Completed += new EventHandler<PhotoResult>(cameracapturetask_Completed);
                    cameracapturetask.Show();

使用CameraCaptureTask,可能是这样

初始化CameraCaptureTask对象

 CameraCaptureTask cameracapturetask = new CameraCaptureTask();
                    cameracapturetask.Completed += new EventHandler<PhotoResult>(cameracapturetask_Completed);
                    cameracapturetask.Show();

使用CameraCaptureTask,可能是这样

初始化CameraCaptureTask对象

 CameraCaptureTask cameracapturetask = new CameraCaptureTask();
                    cameracapturetask.Completed += new EventHandler<PhotoResult>(cameracapturetask_Completed);
                    cameracapturetask.Show();

将图像复制到一个文件夹(图像)中,并设置Build Action==Content

InitializeComponent();
Image i = new Image();
i.Height =100;
i.Width=100;
i.Source = new BitmapImage(new Uri("/Images/YourImageName", UriKind.RelativeOrAbsolute));       
 LayoutRoot.Children.Add(i);
Image i = new Image();
i.Source = new BitmapImage(new Uri("/yourProjectName;component/Assets/YourImageName", UriKind.RelativeOrAbsolute));       
LayoutRoot.Children.Add(i);
// draw an image, set relative source (in project) and add to LayoutRoot.
var i = new Image{
Source = new BitmapImage(
new Uri("/project;component/Images/image.jpg", UriKind.Relative))
};       
LayoutRoot.Children.Add(i);

将图像复制到一个文件夹(图像)中,并设置Build Action==Content

InitializeComponent();
Image i = new Image();
i.Height =100;
i.Width=100;
i.Source = new BitmapImage(new Uri("/Images/YourImageName", UriKind.RelativeOrAbsolute));       
 LayoutRoot.Children.Add(i);
Image i = new Image();
i.Source = new BitmapImage(new Uri("/yourProjectName;component/Assets/YourImageName", UriKind.RelativeOrAbsolute));       
LayoutRoot.Children.Add(i);
// draw an image, set relative source (in project) and add to LayoutRoot.
var i = new Image{
Source = new BitmapImage(
new Uri("/project;component/Images/image.jpg", UriKind.Relative))
};       
LayoutRoot.Children.Add(i);

将图像复制到一个文件夹(图像)中,并设置Build Action==Content

InitializeComponent();
Image i = new Image();
i.Height =100;
i.Width=100;
i.Source = new BitmapImage(new Uri("/Images/YourImageName", UriKind.RelativeOrAbsolute));       
 LayoutRoot.Children.Add(i);
Image i = new Image();
i.Source = new BitmapImage(new Uri("/yourProjectName;component/Assets/YourImageName", UriKind.RelativeOrAbsolute));       
LayoutRoot.Children.Add(i);
// draw an image, set relative source (in project) and add to LayoutRoot.
var i = new Image{
Source = new BitmapImage(
new Uri("/project;component/Images/image.jpg", UriKind.Relative))
};       
LayoutRoot.Children.Add(i);

将图像复制到一个文件夹(图像)中,并设置Build Action==Content

InitializeComponent();
Image i = new Image();
i.Height =100;
i.Width=100;
i.Source = new BitmapImage(new Uri("/Images/YourImageName", UriKind.RelativeOrAbsolute));       
 LayoutRoot.Children.Add(i);
Image i = new Image();
i.Source = new BitmapImage(new Uri("/yourProjectName;component/Assets/YourImageName", UriKind.RelativeOrAbsolute));       
LayoutRoot.Children.Add(i);
// draw an image, set relative source (in project) and add to LayoutRoot.
var i = new Image{
Source = new BitmapImage(
new Uri("/project;component/Images/image.jpg", UriKind.Relative))
};       
LayoutRoot.Children.Add(i);


将图像放入解决方案中。如果我想使用照片/相机卷怎么办?或者只是从相机中拍照?将图像放入解决方案中。如果我想使用照片/相机卷怎么办?或者只是从相机中拍照?将图像放入解决方案中。如果我想使用照片/相机卷怎么办?或者只是从相机中拍照?将图像放入解决方案中。如果我想使用照片/相机卷怎么办?或者只是从相机上拍照?使用它会很有帮助如果我想使用照片/相机卷怎么办?或者只是从相机上拍照?使用它会很有帮助如果我想使用照片/相机卷怎么办?或者只是从相机上拍照?使用它会很有帮助如果我想使用照片/相机卷怎么办?或者只是从相机上拍照?使用它会很有帮助如果我想使用照片/相机卷怎么办?或者只是从相机上拍照?如果我想使用照片/相机卷怎么办?或者只是从相机上拍照?如果我想使用照片/相机卷怎么办?或者只是从相机上拍照?如果我想使用照片/相机卷怎么办?或者只是从相机上拍照?如果我想使用照片/相机卷怎么办?还是仅仅用照相机拍照?