Windows Phone 7 Stock Pivot Control Slow?

I take it you are using the stock Pivot application template as part of the windows phone SDK 7.1 (Mango RTM release), in which case there should be no issues.

Up vote 0 down vote favorite share g+ share fb share tw.

By slow I mean, when I am running my finger across the screen multiple times fast - as I would do on the iPhone it's really slow I take my finger off and it's still going through the windows. I am also testing this on a real device (HTC HD7) on other apps such as IM+, Kik Messenger, etc... it works fine. Code for XAML: C# MainPage.xaml.

Cs Code: 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 PivotApp1 { public partial class MainPage : PhoneApplicationPage { // Constructor public MainPage() { InitializeComponent(); // Set the data context of the listbox control to the sample data DataContext = App.

ViewModel; this. Loaded += new RoutedEventHandler(MainPage_Loaded); } // Load data for the ViewModel Items private void MainPage_Loaded(object sender, RoutedEventArgs e) { if (!App.ViewModel. IsDataLoaded) { App.ViewModel.LoadData(); } } } } C# App.xaml.

Cs Code: 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. Navigation; using System.Windows. Shapes; using Microsoft.Phone.

Controls; using Microsoft.Phone. Shell; namespace PivotApp1 { public partial class App : Application { private static MainViewModel viewModel = null; /// /// A static ViewModel used by the views to bind against. /// /// The MainViewModel object.

Public static MainViewModel ViewModel { get { // Delay creation of the view model until necessary if (viewModel == null) viewModel = new MainViewModel(); return viewModel; } } /// /// Provides easy access to the root frame of the Phone Application. /// /// The root frame of the Phone Application. Public PhoneApplicationFrame RootFrame { get; private set; } /// /// Constructor for the Application object.

/// public App() { // Global handler for uncaught exceptions. UnhandledException += Application_UnhandledException; // Standard Silverlight initialization InitializeComponent(); // Phone-specific initialization InitializePhoneApplication(); // Show graphics profiling information while debugging. If (System.Diagnostics.Debugger.

IsAttached) { // Display the current frame rate counters Application.Current.Host.Settings. EnableFrameRateCounter = true; // Show the areas of the app that are being redrawn in each frame. //Application.Current.Host.Settings.

EnableRedrawRegions = true; // Enable non-production analysis visualization mode, // which shows areas of a page that are handed off to GPU with a colored overlay. //Application.Current.Host.Settings. EnableCacheVisualization = true; // Disable the application idle detection by setting the UserIdleDetectionMode property of the // application's PhoneApplicationService object to Disabled.

// Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run // and consume battery power when the user is not using the phone. PhoneApplicationService.Current.

UserIdleDetectionMode = IdleDetectionMode. Disabled; } } // Code to execute when the application is launching (eg, from Start) // This code will not execute when the application is reactivated private void Application_Launching(object sender, LaunchingEventArgs e) { } // Code to execute when the application is activated (brought to foreground) // This code will not execute when the application is first launched private void Application_Activated(object sender, ActivatedEventArgs e) { // Ensure that application state is restored appropriately if (!App.ViewModel. IsDataLoaded) { App.ViewModel.LoadData(); } } // Code to execute when the application is deactivated (sent to background) // This code will not execute when the application is closing private void Application_Deactivated(object sender, DeactivatedEventArgs e) { } // Code to execute when the application is closing (eg, user hit Back) // This code will not execute when the application is deactivated private void Application_Closing(object sender, ClosingEventArgs e) { // Ensure that required application state is persisted here.

} // Code to execute if a navigation fails private void RootFrame_NavigationFailed(object sender, NavigationFailedEventArgs e) { if (System.Diagnostics.Debugger. IsAttached) { // A navigation has failed; break into the debugger System.Diagnostics.Debugger.Break(); } } // Code to execute on Unhandled Exceptions private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) { if (System.Diagnostics.Debugger. IsAttached) { // An unhandled exception has occurred; break into the debugger System.Diagnostics.Debugger.Break(); } } #region Phone application initialization // Avoid double-initialization private bool phoneApplicationInitialized = false; // Do not add any additional code to this method private void InitializePhoneApplication() { if (phoneApplicationInitialized) return; // Create the frame but don't set it as RootVisual yet; this allows the splash // screen to remain active until the application is ready to render.

RootFrame = new PhoneApplicationFrame(); RootFrame. Navigated += CompleteInitializePhoneApplication; // Handle navigation failures RootFrame. NavigationFailed += RootFrame_NavigationFailed; // Ensure we don't initialize again phoneApplicationInitialized = true; } // Do not add any additional code to this method private void CompleteInitializePhoneApplication(object sender, NavigationEventArgs e) { // Set the root visual to allow the application to render if (RootVisual!

= RootFrame) RootVisual = RootFrame; // Remove this handler since it is no longer needed RootFrame. Navigated -= CompleteInitializePhoneApplication; } #endregion } } C# MainViewModel. Cs using System; using System.

ComponentModel; using System.Collections. Generic; using System. Diagnostics; using System.

Text; using System. Windows; using System.Windows. Controls; using System.Windows.

Data; using System.Windows. Documents; using System.Windows. Input; using System.Windows.

Media; using System.Windows.Media. Imaging; using System.Windows. Shapes; using System.Collections.

ObjectModel; namespace PivotApp1 { public class MainViewModel : INotifyPropertyChanged { public MainViewModel() { this. Items = new ObservableCollection(); } /// /// A collection for ItemViewModel objects. /// public ObservableCollection Items { get; private set; } private string _sampleProperty = "Sample Runtime Property Value"; /// /// Sample ViewModel property; this property is used in the view to display its value using a Binding /// /// public string SampleProperty { get { return _sampleProperty; } set { if (value!

= _sampleProperty) { _sampleProperty = value; NotifyPropertyChanged("SampleProperty"); } } } public bool IsDataLoaded { get; private set; } /// /// Creates and adds a few ItemViewModel objects into the Items collection. /// public void LoadData() { // Sample data; replace with real data this.Items. Add(new ItemViewModel() { LineOne = "runtime one", LineTwo = "Maecenas praesent accumsan bibendum", LineThree = "Facilisi faucibus habitant inceptos interdum lobortis nascetur pharetra placerat pulvinar sagittis senectus sociosqu" }); this.Items.

Add(new ItemViewModel() { LineOne = "runtime two", LineTwo = "Dictumst eleifend facilisi faucibus", LineThree = "Suscipit torquent ultrices vehicula volutpat maecenas praesent accumsan bibendum dictumst eleifend facilisi faucibus" }); this.Items. Add(new ItemViewModel() { LineOne = "runtime three", LineTwo = "Habitant inceptos interdum lobortis", LineThree = "Habitant inceptos interdum lobortis nascetur pharetra placerat pulvinar sagittis senectus sociosqu suscipit torquent" }); this.Items. Add(new ItemViewModel() { LineOne = "runtime four", LineTwo = "Nascetur pharetra placerat pulvinar", LineThree = "Ultrices vehicula volutpat maecenas praesent accumsan bibendum dictumst eleifend facilisi faucibus habitant inceptos" }); this.Items.

Add(new ItemViewModel() { LineOne = "runtime five", LineTwo = "Maecenas praesent accumsan bibendum", LineThree = "Maecenas praesent accumsan bibendum dictumst eleifend facilisi faucibus habitant inceptos interdum lobortis nascetur" }); this.Items. Add(new ItemViewModel() { LineOne = "runtime six", LineTwo = "Dictumst eleifend facilisi faucibus", LineThree = "Pharetra placerat pulvinar sagittis senectus sociosqu suscipit torquent ultrices vehicula volutpat maecenas praesent" }); this.Items. Add(new ItemViewModel() { LineOne = "runtime seven", LineTwo = "Habitant inceptos interdum lobortis", LineThree = "Accumsan bibendum dictumst eleifend facilisi faucibus habitant inceptos interdum lobortis nascetur pharetra placerat" }); this.Items.

Add(new ItemViewModel() { LineOne = "runtime eight", LineTwo = "Nascetur pharetra placerat pulvinar", LineThree = "Pulvinar sagittis senectus sociosqu suscipit torquent ultrices vehicula volutpat maecenas praesent accumsan bibendum" }); this.Items. Add(new ItemViewModel() { LineOne = "runtime nine", LineTwo = "Maecenas praesent accumsan bibendum", LineThree = "Facilisi faucibus habitant inceptos interdum lobortis nascetur pharetra placerat pulvinar sagittis senectus sociosqu" }); this.Items. Add(new ItemViewModel() { LineOne = "runtime ten", LineTwo = "Dictumst eleifend facilisi faucibus", LineThree = "Suscipit torquent ultrices vehicula volutpat maecenas praesent accumsan bibendum dictumst eleifend facilisi faucibus" }); this.Items.

Add(new ItemViewModel() { LineOne = "runtime eleven", LineTwo = "Habitant inceptos interdum lobortis", LineThree = "Habitant inceptos interdum lobortis nascetur pharetra placerat pulvinar sagittis senectus sociosqu suscipit torquent" }); this.Items. Add(new ItemViewModel() { LineOne = "runtime twelve", LineTwo = "Nascetur pharetra placerat pulvinar", LineThree = "Ultrices vehicula volutpat maecenas praesent accumsan bibendum dictumst eleifend facilisi faucibus habitant inceptos" }); this.Items. Add(new ItemViewModel() { LineOne = "runtime thirteen", LineTwo = "Maecenas praesent accumsan bibendum", LineThree = "Maecenas praesent accumsan bibendum dictumst eleifend facilisi faucibus habitant inceptos interdum lobortis nascetur" }); this.Items.

Add(new ItemViewModel() { LineOne = "runtime fourteen", LineTwo = "Dictumst eleifend facilisi faucibus", LineThree = "Pharetra placerat pulvinar sagittis senectus sociosqu suscipit torquent ultrices vehicula volutpat maecenas praesent" }); this.Items. Add(new ItemViewModel() { LineOne = "runtime fifteen", LineTwo = "Habitant inceptos interdum lobortis", LineThree = "Accumsan bibendum dictumst eleifend facilisi faucibus habitant inceptos interdum lobortis nascetur pharetra placerat" }); this.Items. Add(new ItemViewModel() { LineOne = "runtime sixteen", LineTwo = "Nascetur pharetra placerat pulvinar", LineThree = "Pulvinar sagittis senectus sociosqu suscipit torquent ultrices vehicula volutpat maecenas praesent accumsan bibendum" }); this.

IsDataLoaded = true; } public event PropertyChangedEventHandler PropertyChanged; private void NotifyPropertyChanged(String propertyName) { PropertyChangedEventHandler handler = PropertyChanged; if (null! = handler) { handler(this, new PropertyChangedEventArgs(propertyName)); } } } } C# ItemViewModel. Cs using System; using System.

ComponentModel; using System. Diagnostics; using System. Net; using System.

Windows; using System.Windows. Controls; using System.Windows. Documents; using System.Windows.

Ink; using System.Windows. Input; using System.Windows. Media; using System.Windows.Media.

Animation; using System.Windows. Shapes; namespace PivotApp1 { public class ItemViewModel : INotifyPropertyChanged { private string _lineOne; /// /// Sample ViewModel property; this property is used in the view to display its value using a Binding. /// /// public string LineOne { get { return _lineOne; } set { if (value!

= _lineOne) { _lineOne = value; NotifyPropertyChanged("LineOne"); } } } private string _lineTwo; /// /// Sample ViewModel property; this property is used in the view to display its value using a Binding. /// /// public string LineTwo { get { return _lineTwo; } set { if (value! = _lineTwo) { _lineTwo = value; NotifyPropertyChanged("LineTwo"); } } } private string _lineThree; /// /// Sample ViewModel property; this property is used in the view to display its value using a Binding.

/// /// public string LineThree { get { return _lineThree; } set { if (value! = _lineThree) { _lineThree = value; NotifyPropertyChanged("LineThree"); } } } public event PropertyChangedEventHandler PropertyChanged; private void NotifyPropertyChanged(String propertyName) { PropertyChangedEventHandler handler = PropertyChanged; if (null! = handler) { handler(this, new PropertyChangedEventArgs(propertyName)); } } } } I'm running the version of WP 7.1 which was released a few days ago on Microsoft's website.

I can't figure out how to get the application to speed up as it lags in comparison to iOS when bringing my finger across and it's not smooth, I take it off for a few seconds and it's still trying to catch up to where I was. Xaml windows-phone-7 windows-phone-7.1 windows-phone-7.5 link|improve this question edited Oct 3 '11 at 15:39Claus Jørgensen10.4k41238 asked Oct 3 '11 at 0:44Eric327111 83% accept rate.

I take it you are using the stock Pivot application template as part of the windows phone SDK 7.1 (Mango RTM release), in which case there should be no issues. I've just fired up the template locally and ran it with no issues, so you might want to try a fresh copy if you can. In the template there is no C# to speak of, it just loads up two lists for displaying to the two list boxes in the view, nothing special there.

Granted it is not the most efficient way of doing this as the display will not render until BOTH the lists are populated, better to use some level of virtualisation and load the two lists separately for each view. I take on board Claus's comment about using a grid over a stackpanel but in most cases unless you are using stack panels within stack panels there is no real issue and the benefit of how a stack panel handles layout can be a huge benefit. Let me know if you have done anything else to the default template and I'll expand where I can.

This is a standard new project, no changes as of yet. The XAML was created by Microsoft as I haven't changed it, above I will add the C# code to both App.xaml. Cs and MainPage.xaml.cs.

Thank you. – Eric Oct 3 '11 at 15:14.

Your problem isn't related to your XAML. It's related to the C# code running in the background. The problem is you're adding a heavy load to the UI thread, and as such the navigation between pivots, which is also running on the UI thread, lags heavily.

We'll need to see the related C# code (code-behind / viewmodel, etc.) to give more detailed advice. As for your XAML, a good advice would be to use a Grid instead of StackPanel in your DataTemplate if possible, since it improves virtualization of the list elements.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions