通过 WP7 中的代码设置 panoramaItem Orientation

发布于 2025-01-08 05:04:08 字数 579 浏览 4 评论 0原文

我已将图像从 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

赴月观长安 2025-01-15 05:04:08

PanoramaItem 有一个 Orientation 属性用于处理滚动方向。它采用 System.Windows.Controls.Orientation 程序集中的 System.Windows.Controls.Orientation 枚举值。您的代码应如下所示:

using System.Windows.Controls;

方向分配:

panoramaItem.Orientation = Orientation.Horizontal;

PanoramaItem has an Orientation property for handling scrolling direction. It takes value of System.Windows.Controls.Orientation enum in System.Windows assembly. Your code should looks like:

using System.Windows.Controls;

And orientation assigment:

panoramaItem.Orientation = Orientation.Horizontal;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文