I am currently coding an application that involves navigating between pivot control.
There will be a total of 8 pivots. I’ve already done one and am currently working on the second one. However, when I repeat the same thing as what I did with the first pivot control, an error shows up. Please refer below for the code and the error.
I am new to WP7 development. Any help would be much appreciated.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
namespace SGFoodDirectory
{
public partial class Alcohol : PhoneApplicationPage
{
public Alcohol()
{
InitializeComponent();
}
private void BC_Click(object sender, RoutedEventArgs e)
{
AlPivot.SelectedItem = BcPivot;
}
private void MabukMoney_Click(object sender, RoutedEventArgs e)
{
AlPivot.SelectedItem = MmPivot;
}
}
}
Error:
Microsoft.Phone.Controls.PivotItem' does not contain a definition for 'SelectedItems' and no extension method 'SelectedItems' accepting a first argument of type 'Microsoft.Phone.Controls.PivotItem' could be found (are you missing a using directive or an assembly reference?)
Please don’t do that – pivots are designed to be navigated by the user using touch. From experience of seeing other apps that do this it is very confusing if the code jumps you to another pivot item on a button click.
Also, having 8 pivot items seems a bit high: this may well cause problems with memory usage as well as the general usability of having to flick your page 8 times to rotate back to the start.
I’d recommend rethinking your application flow using other PhoneApplicationPages so you don’t need to do this.