Get a Jump on Navigation in Windows Phone with the LongListSelector: Listing 4.

Applying the TiltEffect to the GroupView.

 <toolkit:LongListSelector 
  GroupViewOpened="GroupViewOpened"
  GroupViewClosing="GroupViewClosing" ... 

private Type addedType;
private void GroupViewOpened(object sender, GroupViewOpenedEventArgs e)
{
  var control = e.ItemsControl.Parent as UIElement;
  var generator = e.ItemsControl.ItemContainerGenerator;
            
  foreach (var item in e.ItemsControl.Items)
  {
    var container = generator.ContainerFromItem(item);
    if (addedType==null)
    {
      addedType = container.GetType();
      TiltEffect.TiltableItems.Add(addedType);
    }
    if(container!=null)
    {
      TiltEffect.SetIsTiltEnabled(container, true);        
    }
  }
            
      ScrollViewer.SetVerticalScrollBarVisibility(control,
        ScrollBarVisibility.Disabled);

}

private void GroupViewClosing(object sender, GroupViewClosingEventArgs e)
{
  if (addedType != null)
  {
    TiltEffect.TiltableItems.Remove(addedType);
    addedType = null;
  }

}

About the Author

Nick Randolph runs Built to Roam, a consulting company that specializes in training, mentoring and assisting other companies build mobile applications. With a heritage in rich client applications for both the desktop and a variety of mobile platforms, Nick currently presents, writes and educates on the Windows Phone platform.

comments powered by Disqus

Featured

Subscribe on YouTube