通过 WP7 中的代码设置 panoramaItem Orientation
我已将图像从 url 动态添加到全景项目。我需要宽度为 800,图像也应该位于下一个项目空间中。为此,在我之前的应用程序中,我已在 Xaml 中将方向设置为水平。但不,我需要在代码中设置,但我不能有什么方法可以做到这一点。
private void AddItem(string uri, string header)
{
var panoramaItem = new PanoramaItem();
panoramaItem.Width = 800;
panoramaItem.Height = 550;
panoramaItem.Header = "";
var grid = new Grid();
var image = new Image();
image.Source = new BitmapImage(new Uri(uri, UriKind.RelativeOrAbsolute));
panoramaItem.Content = image;
pan.Items.Add(panoramaItem);
}
I have added the images dynamtically from a url to panorama item. I need the width to be 800 which the image should be in the next item space also. For that in my previous application I have set the orientation to horizontal in Xaml. But no i need to set in code but i cant is there any way to do that.
private void AddItem(string uri, string header)
{
var panoramaItem = new PanoramaItem();
panoramaItem.Width = 800;
panoramaItem.Height = 550;
panoramaItem.Header = "";
var grid = new Grid();
var image = new Image();
image.Source = new BitmapImage(new Uri(uri, UriKind.RelativeOrAbsolute));
panoramaItem.Content = image;
pan.Items.Add(panoramaItem);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
PanoramaItem
有一个Orientation
属性用于处理滚动方向。它采用 System.Windows.Controls.Orientation 程序集中的 System.Windows.Controls.Orientation 枚举值。您的代码应如下所示:方向分配:
PanoramaItem
has anOrientation
property for handling scrolling direction. It takes value ofSystem.Windows.Controls.Orientation
enum inSystem.Windows
assembly. Your code should looks like:And orientation assigment: