Issue #156

This post was from long time ago when I did Windows Phone 7

Welcome back, today I will start writing all stuff, all the secret I ’ve revealed when developing for Windows Phone 7.

  1. When setting UIElement’s Visibility to Collapsed, the OS set its Height to 0. So if you need to have a Height of 0, simply set Height="0", which is faster in term of show time.

  2. When clearing data source, ListBox which uses VirtualizingStackPanel does not rememeber its last view, whereas StackPanel does

  3. ListBox which is inside ScrollViewer will lose its UI virtualization, even if you use VirtualizingStackPanel

  4. Using GestureListener incorrectly will cause other UIElement to not work, i.e Slider, …

  5. AdControl, ContextMenu may be a source of memory leak.

  6. Panorama control still enable swiping when there is only 1 PanoramaItem, whereas Pivot does not.

  7. Pivot control will load the current PivotItem, as well as its direct left and right PivotItem.

  8. Sometimes SIP keyboard does not show up, check your phone for physical keyboard problem.

  9. There is no way to rate a Song for 3rd app

  10. When emulator rendering has overlap issue, the workaround is to set LayoutRoot ’s Background to a solid color

  11. Supposed you’re using ObservableCollection bindSource as binding source for ListBox. When adding items to bindSource quickly, ListBox seems to suppress creating ListBoxItem until all items are added. It is advised to add items in batch

  12. WebBrowser control does not have scroll bar

  13. Using StoryBoard when ever possible, because all of its animation is done in Compositor Thread, which leverages GPU

  14. Use ProgressIndicator for best performance and UX familiarity

  15. Collapse unimportant UIElement to decrease load time, and show them when Page is completely loaded.

  16. Always unsubscribe to event source that can continue to run when the Page is navigated from, because that may cause memory leak. Examples are timer, BackgroundAudioPlayer.PlayeStateChanged, …

  17. Using file is much faster than Local Database

  18. Remember the limit 260 characters of query string