SENTHIL KUMAR
SENTHIL KUMAR

Reputation: 647

Set panoramaItem Orientation via code in WP7

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);
    }

Upvotes: 0

Views: 314

Answers (1)

Ku6opr
Ku6opr

Reputation: 8126

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;

Upvotes: 1

Related Questions