Ivan Pavić
Ivan Pavić

Reputation: 538

windows phone 8 layout for beginners

I want to make an app that has on one uri several "pages" that you can scroll to useing scroll right or scroll left gestures I imagined doing it by makeing fiew grids one next to another but I can think of several problems, at begening I should position user on certain page depending of things selected on another page and I shouldn't allow user to stop scrolling and end up between those pages.

Upvotes: 0

Views: 244

Answers (2)

Ibrahim Abdelkareem
Ibrahim Abdelkareem

Reputation: 957

This simply can be done using pivot

XAML

<phone:Pivot Title="MyApplicationName" x:Name="MyPivot">
  <phone:PivotItem Header="Pivot Page1">
    <Grid> 
      ///Place here Your Page Content 
    </Grid>
  </phone:PivotItem>

<phone:PivotItem Header="Pivot Page2">
    <Grid> 
      ///Place here Your Second Page Content 
    </Grid>
  </phone:PivotItem>
<phone:Pivot>

And for getting user to a specific page just pass an argument when navigating to this page for example

C# First Page

NavigationService.Navigate(new Uri("/OurPage2.xaml?n"=TheNumberYouWant.ToString(),UriKind.Relative);

Second Page

protected override OnNavigatedTo( NavigationEventArgs e)
{
  int index = 0; //Default
  string temp;
  NavigationContext.QueryString.TryGetValue("n", out temp);
  if(!string.IsNullOrEmpty(temp))
    index = int.Parse(temp);
  MyPivot.SelectedIndex = index;
}

Upvotes: 1

Jon B
Jon B

Reputation: 885

Look into using the Panorama or Pivot controls.

Upvotes: 1

Related Questions