嫩草视频 两个人的免费视频完整版 午夜视频 好大哥dgdg 骚虎视频 嫩草视频 嫩草视频 骚虎视频 影视大全免费追剧 两个人的免费视频完整版 影视大全 嫩草官网 啦啦啦免费观看视频6 影视大全高清版 野花在线观看免费视频 嫩草视频 骚虎视频入口 免费无限资源 好大哥dgdg 啦啦啦免费观看视频6 啦啦啦免费观看视频6 两个人的免费视频完整版 啦啦啦免费观看视频6 骚虎视频入口 影视大全 啦啦啦免费观看视频6 嫩草视频 野花在线观看免费视频 啦啦啦免费观看视频6 影视大全 影视大全 骚虎视频入口 影视大全免费追剧 24小时日本在线视频 嫩草官网 影视大全免费追剧

How to Create a Panorama Application for Windows Phone 7 - [Part-6]


In this article, I will explain one of the most compiling control of windows phone 7. In this part we will learn how to develop Panorama UI (User Interface) based application in Windows Phone 7. Panoramic Navigation allows you to display data in horizontal manner.

In this article we will discuss about how to develop panorama application for Windows Phone 7. Panorama is a compiling control of windows phone 7.

What is panorama?
Lets us know about Panorama, Its mean capturing a series of images to create a pictures wider than, in a single image by "Stitching" the photographs together.

Why panorama's view?
Panoramic experiences offer a unique way to view data, controls and services by using a long horizontal canvas that extends beyond the confines of the screen.

Objective of this application is to display my friend's data and it will show my different –different social networks (like Google+, Facebook, LinkedIn and Twitter) friends list on the panorama screen.

Let's come to the application development part, here we go.

In this post I will show you how to create a panorama application in Windows Phone 7. This post illustrates the following steps:

Step:-1 Open Visual Studio 2010 Ultimate or Express for Windows Phone from the Start menu.

Step:-2 Create a new project by selecting the File menu and click on New Project.

Step:-3 New Project dialog window will be displayed. Expand the Visual C# templates, and then select the Silverlight for Windows Phone templates –> Select "Windows Phone Application" and enter the project name.


Image-1


Step:-4 New project will be created with MainPage.xaml page and it will be opened in the Visual Studio2010 IDE. Now right-click on project in Solution Explorer and click on Add then click on New Item. Select Windows Phone Panorama Page.













And now enter your desired name of panorama page (in this project I have used default name of PanoramaPage1.xaml) and click on Add bottom. PanoramaPage1 will come up with the default background image. And keep this page in view directory.

Step:-5 add an image (I have used PanoramaBackground.png) to display panorama page background. After add this image it will automatically become a resource image of the application. To check the build action select the PanoramaBackground.png image and press F4 key and see Build Action property is Resource only.






Step:-6 now set the panorama control's background. See below xaml code snippet.

 
<controls:Panorama.Background >
<ImageBrush ImageSource="/WP_PanoramaApp;component/PanoramaBackground.png"/ >
</controls:Panorama.Background >


Then you are able to view background image at design time in IDE see below picture.






Important: You must be aware about how to use resource files in the Windows Phone 7 application. See here

Note: For the time being I have used some static data. To display the data, I have used MVVM (Model View ViewModel) pattern (MVVM pattern we will discussed later in this series).

Step:-7 To display, friends pictures on the panorama control I have added different – different social network friend's pictures in this application and set Build Action type Content instead of Resource to all pictures property.






Step:-8 create a generic class to access the all social networks friend's data like (name, details and imagepath) I have created an ItemViewModel class which will responsible to provide friend's data to view. This class basically derived with an INotifyPropertyChanged interface and it is implemented an event name is PropertyChangedEventHandler; and this event call by each property.


 

public class ItemViewModel : INotifyPropertyChanged
{
private string _name;
private string _imagePath;
private string _details;

public string Name
{
get { return _name; }
set
{
if (value != _name)
{
_name = value;
NotifyPropertyChanged("Name");
}
}
}

public string ImagePath
{
get { return _imagePath; }
set
{
if (value != _imagePath)
{
_imagePath = value;
NotifyPropertyChanged("ImagePath");
}
}
}

public string Details
{
get { return _details; }
set
{
if (value != _details)
{
_details = value;
NotifyPropertyChanged("Details");
}
}
}

#region INotifyPropertyChanged Members

public event PropertyChangedEventHandler PropertyChanged;

private void NotifyPropertyChanged(String propertyName)
{
PropertyChangedEventHandler handler = PropertyChanged;
if (null != handler)
{
handler(this, new PropertyChangedEventArgs(propertyName));
}
}
#endregion
}




Step:-9 create a PanoramaViewModel class to store the static data; the purpose of this class View-Model is responsible for exposing the data objects from the Model in such a way that those objects are easily managed and consumed. Here I have added some static data of different -2 social network's friend.

See below code snippet:

 

public class PanoramaViewModel
{

public PanoramaViewModel()
{
this.Items = new ObservableCollection();
this.GooglePlusItems = new ObservableCollection();
this.FacebookItems = new ObservableCollection();
this.LinkedIn = new ObservableCollection();
this.Twitter = new ObservableCollection();
}

///
/// A collection for ItemViewModel objects.
///

public ObservableCollection Items { get; private set; }

public bool IsDataLoaded {get; private set; }

///
/// Creates and adds a few ItemViewModel objects into the Items collection.
///

public void LoadData()
{
// Sample data; here you can replace with real data
this.Items.Add(new ItemViewModel() { Name = "Google+", ImagePath =
"/Networks/Facebook/1.jpg", Details = "" });
this.Items.Add(new ItemViewModel() { Name = "Facebook", ImagePath =
"/Networks/Facebook/2.jpg", Details = "" });
this.Items.Add(new ItemViewModel() { Name = "LinkedIn", ImagePath =
"/Networks/Facebook/3.jpg", Details = "" });
this.Items.Add(new ItemViewModel() { Name = "Twitter", ImagePath =
"/Networks/Facebook/4.jpg", Details = "" });
this.IsDataLoaded = true;
}

///
/// A collection for ItemViewModel objects.
///

public ObservableCollection GooglePlusItems { get; private set; }

///
/// Creates and adds a few ItemViewModel objects into the Items collection.
///

public void LoadGooglePlusData()
{
// Sample data; replace with real data
this.GooglePlusItems.Add(new ItemViewModel() {
Name = "Pinal Dave",
ImagePath = "/Networks/GoolgePlus/1.jpg",
Details = "MVP" });
this.GooglePlusItems.Add(new ItemViewModel() {
Name = "Abhishek Kumar",
ImagePath = "/Networks/GoolgePlus/2.jpg",
Details = "SSE" });
this.GooglePlusItems.Add(new ItemViewModel() {
Name = "Gaurav Arora",
ImagePath = "/Networks/GoolgePlus/3.jpg",
Details = "MVP" });
this.GooglePlusItems.Add(new ItemViewModel() {
Name = "Sachin Kapse",
ImagePath = "/Networks/GoolgePlus/4.jpg",
Details = "SSE" });
this.GooglePlusItems.Add(new ItemViewModel() {
Name = "Mitesh",
ImagePath = "/Networks/GoolgePlus/5.jpg",
Details = "SSE" });
this.IsDataLoaded = true;
}

///
/// A collection for ItemViewModel objects.
///

public ObservableCollection FacebookItems { get; private set; }

///
/// Creates and adds a few ItemViewModel objects into the Items collection.
///

public void LoadFacebookData()
{
// Sample data; replace with real data
this.FacebookItems.Add(new ItemViewModel() {
Name = "Vinod Kumar",
ImagePath = "/Networks/Facebook/6.jpg",
Details = "MVP" });
this.FacebookItems.Add(new ItemViewModel() {
Name = "Dhananjay Kumar",
ImagePath = "/Networks/Facebook/1.jpg",
Details = "MVP" });
this.FacebookItems.Add(new ItemViewModel() {
Name = "Kunal Chowdhury",
ImagePath = "/Networks/Facebook/2.jpg",
Details = "MVP" });
this.FacebookItems.Add(new ItemViewModel() { Name =
"Malleswar",
ImagePath = "/Networks/Facebook/7.jpg",
Details = "MVP" });
this.FacebookItems.Add(new ItemViewModel() {
Name = "Mohsin",
ImagePath = "/Networks/Facebook/3.jpg",
Details = "SSE" });
this.FacebookItems.Add(new ItemViewModel() {
Name = "Sawkat Ali",
ImagePath = "/Networks/Facebook/4.jpg",
Details = "SSE" });
this.FacebookItems.Add(new ItemViewModel() {
Name = "Karan Singh",
ImagePath = "/Networks/Facebook/5.jpg",
Details = "SSE" });
this.IsDataLoaded = true;
}

///
/// A collection for ItemViewModel objects.
///

public ObservableCollection LinkedIn { get; private set; }


///
/// Creates and adds a few ItemViewModel objects into the Items collection.
///

public void LoadLinkedInData()
{
// Sample data; replace with real data
this.LinkedIn.Add(new ItemViewModel() {
Name = "Daniel Vaughan",
ImagePath = "/Networks/LinkedIn/1.jpg",
Details = "MVP" });
this.LinkedIn.Add(new ItemViewModel() {
Name = "Pavan Pareta",
ImagePath = "/Networks/LinkedIn/2.jpg",
Details = "MVP" });
this.LinkedIn.Add(new ItemViewModel() {
Name = "Boryana Miloshevska",
ImagePath = "/Networks/LinkedIn/3.jpg",
Details = "MVP" });
this.LinkedIn.Add(new ItemViewModel() {
Name = "Dhananjay Kumar",
ImagePath = "/Networks/LinkedIn/4.jpg",
Details = "MVP" });
this.LinkedIn.Add(new ItemViewModel() {
Name = "Laurent Bugnion",
ImagePath = "/Networks/LinkedIn/5.jpg",
Details = "MVP" });
this.IsDataLoaded = true;
}

///
/// A collection for ItemViewModel objects.
///

public ObservableCollection Twitter { get; private set; }

///
/// Creates and adds a few ItemViewModel objects into the Items collection.
///

public void LoadTwitterData()
{
// Sample data; replace with real data
this.Twitter.Add(new ItemViewModel() {
Name = "Vesko Kolev",
ImagePath = "/Networks/Twitter/0.jpg",
Details = "SSE" });
this.Twitter.Add(new ItemViewModel() { Name =
"Joel Ivory Johnson",
ImagePath = "/Networks/Twitter/1.jpg",
Details = "MVP" });
this.Twitter.Add(new ItemViewModel() {
Name = "Rajesh Rao",
ImagePath = "/Networks/Twitter/2.jpg",
Details = "iPhone Dev Expert" });
this.Twitter.Add(new ItemViewModel() { Name =
"Harish Ranganathan",
ImagePath = "/Networks/Twitter/3.jpg",
Details = "Evangelist, Microsoft India" });
this.Twitter.Add(new ItemViewModel() {
Name = "Jouni Miettunen",
ImagePath = "/Networks/Twitter/4.jpg",
Details = "MVP" });
this.Twitter.Add(new ItemViewModel() { Name =
"Babina Sebastian",
ImagePath = "/Networks/Twitter/5.jpg",
Details = "..." });
this.Twitter.Add(new ItemViewModel() {
Name = "Rahul",
ImagePath = "/Networks/Twitter/6.jpg",
Details = "Teacher" });
this.Twitter.Add(new ItemViewModel() {
Name = "Anand",
ImagePath = "/Networks/Twitter/7.jpg",
Details = "Teacher" });
this.Twitter.Add(new ItemViewModel() {
Name = "Daniel Vaughan",
ImagePath = "/Networks/Twitter/8.png",
Details = "MVP" });
this.Twitter.Add(new ItemViewModel() {
Name = "Ashish",
ImagePath = "/Networks/Twitter/9.jpg",
Details = "Lead" });
this.Twitter.Add(new ItemViewModel() {
Name = "Paul Diston",
ImagePath = "/Networks/Twitter/10.jpg",
Details = "SSE" });
this.IsDataLoaded = true;
}
}




Step:-10 code is ready to integrate with the panorama UI control, now we have to add required Panorama Items under the panorama control. For this application I have added 5 panorama items for index of social networks, Google+, Facebook, Linkedin and Twitter. See blow xaml code snippet.


<controls:Panorama x:Name="pnrmNetwork" Title="my friend(s)">

<controls:Panorama.Background>
<ImageBrush
ImageSource="/WP_PanoramaApp;component/PanoramaBackground.png"/>
</controls:Panorama.Background>
<!--Panorama item one-->
<controls:PanoramaItem Header="My Networks" Foreground="Blue">
<!--Double line list with text wrapping-->
<ListBox Margin="0,0,-12,0" ItemsSource="{Binding Items}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Margin="0,0,0,5" Width="432" Height="78">
<TextBlock Text="{Binding Name}" TextWrapping="Wrap"
Style="{StaticResource PhoneTextExtraLargeStyle}"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</controls:PanoramaItem>

<!--Panorama item two (Google+)-->
<controls:PanoramaItem Header="Goolge+" Foreground="Crimson">
<!--Double line list with image placeholder and text wrapping-->
<ListBox Margin="0,0,-12,0" ItemsSource="{Binding GooglePlusItems}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Margin="0,0,0,17">
<Image Width="100" Height="100"
Source="{Binding ImagePath}"></Image>
<StackPanel Width="311">
<TextBlock Text="{Binding Name}" TextWrapping="Wrap"
Style="{StaticResource PhoneTextExtraLargeStyle}"/>
<TextBlock Text="{Binding Details}"
TextWrapping="NoWrap" Margin="12,-6,12,0"
Style="{StaticResource PhoneTextSubtleStyle}"/>
</StackPanel>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</controls:PanoramaItem>

<!--Panorama item three (LinkedIn)-->
<controls:PanoramaItem Header="LinkedIn" Foreground="SpringGreen">
<!--Double line list with image placeholder and text wrapping-->
<ListBox Margin="0,0,-12,0" ItemsSource="{Binding LinkedIn}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Margin="0,0,0,17">
<Image Width="100" Height="100"
Source="{Binding ImagePath}"></Image>
<!--Replace rectangle with image-->
<StackPanel Width="311">
<TextBlock Text="{Binding Name}" TextWrapping="Wrap"
Style="{StaticResource PhoneTextExtraLargeStyle}"/>
<TextBlock Text="{Binding Details}"
TextWrapping="NoWrap" Margin="12,-6,12,0"
Style="{StaticResource PhoneTextSubtleStyle}"/>
</StackPanel>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</controls:PanoramaItem>

<!--Panorama item four (Twitter)-->

<controls:PanoramaItem Header="Twitter" Foreground="Coral">
<!--Double line list with image placeholder and text wrapping-->
<ListBox Margin="0,0,-12,0" ItemsSource="{Binding Twitter}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Margin="0,0,0,17">
<!--Replace rectangle with image-->
<Image Width="100" Height="100"
Source="{Binding ImagePath}"></Image>
<StackPanel Width="311">
<TextBlock Text="{Binding Name}"
TextWrapping="Wrap"
Style="{StaticResource PhoneTextExtraLargeStyle}"/>
<TextBlock Text="{Binding Details}"
TextWrapping="Wrap" Margin="12,-6,12,0"
Style="{StaticResource PhoneTextSubtleStyle}"/>
</StackPanel>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</controls:PanoramaItem>

<!--Panorama item five (Facebook)-->

<controls:PanoramaItem
Header="Facebook" Foreground="Aquamarine">
<!--Double line list with image placeholder and text wrapping-->
<ListBox Margin="0,0,-12,0"
ItemsSource="{Binding FacebookItems}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal"
Margin="0,0,0,17">
<!--Replace rectangle with image-->
<Image Width="100" Height="100"
Source="{Binding ImagePath}"></Image>
<StackPanel Width="311">
<TextBlock Text="{Binding Name}"
TextWrapping="Wrap"
Style="{StaticResource PhoneTextExtraLargeStyle}"/>
<TextBlock Text="{Binding Details}"
TextWrapping="NoWrap" Margin="12,-6,12,0"
Style="{StaticResource PhoneTextSubtleStyle}"/>
</StackPanel>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>

</controls:PanoramaItem>

</controls:Panorama>









Step:-11 double click on Panorama Application Button and write code in code behind use below code snippet for navigate the panorama page.


private void btnPanoramaApplication(object sender, RoutedEventArgs e)
{
this.NavigationService.Navigate(new Uri("/views/PanoramaPage1.xaml",
UriKind.Relative));
}


Important: Need to assign DataContext in the PanoramaPage1 constructor. The

DataContext allow a property that serves as a simple means of accessing individual instances of the ItemViewModel class through a collection declared to be of type ObservableCollection .

Step:-12 Now run the application using F5 button and navigate the panorama application.




Thank you for your time.


Attachments

Comments



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email:
    好大哥影视-好大哥视频-好大哥官网-好大哥电影 骚虎视频官方-房事视频免费看 四虎视频官方-女人本色高清视频 午夜视频官方-24小时日本在线视频 好大哥视频-好大哥dgdg 野花在线官方-影视大全 久草视频入口-嫩草视频官网 小草视频入口-两个人观看野花免费视频 嫩草视频入口-大片免费视频