This question is locked. New answers and comments are not allowed.
I'm building functionality that allows changing the filter and group picker. Basically i have a phonebook style and normal default style. What i'm seeing is once i display the group picker i can no longer change the template used. Is there a special way you have to reset that? Here's a sniplet of the code.
RadJumpList list = null;
// determine which list to manipulate
if (args.ViewType == MainViewType.Favorites)
{
list = this.favoriteJumpList;
}
else if (args.ViewType == MainViewType.Scenes)
{
list = this.sceneJumpList;
}
else if (args.ViewType == MainViewType.Devices)
{
list = this.deviceJumpList;
}
// reset the template info
if (args.ViewType == MainViewType.Favorites)
list.GroupPickerItemTap -= FavoriteJumpListGroupPickerItemTap;
else if (args.ViewType == MainViewType.Scenes)
list.GroupPickerItemTap -= SceneJumpListGroupPickerItemTap;
else if (args.ViewType == MainViewType.Devices)
list.GroupPickerItemTap -= DeviceJumpListGroupPickerItemTap;
list.GroupHeaderTemplate = null;
list.GroupPickerItemsSource = null;
list.GroupPickerItemTemplate = null;
list.GroupPickerItemStyle = null;
list.GroupPickerItemTemplateSelector = null;
list.GroupPickerItemsPanel = null;
list.StickyHeaderTemplate = null;
list.GroupDescriptors.Clear();
list.SortDescriptors.Clear();
if (args.GroupByType == MainViewGroupByType.Alphabetical)
{
GenericGroupDescriptor<VeraItem, string> groupBy = new GenericGroupDescriptor<VeraItem, string>(item => Regex.IsMatch(item.Name.Substring(0, 1).ToLower(), "^[a-z]{1}$") ? item.Name.Substring(0, 1).ToLower() : "#");
GenericSortDescriptor<VeraItem, string> sortBy = new GenericSortDescriptor<VeraItem, string>(item => item.Name);
list.IsStickyHeaderEnabled = true;
string alphabet = "#abcdefghijklmnopqrstuvwxyz";
List<string> groupPickerItems = new List<string>(32);
foreach (char c in alphabet)
{
groupPickerItems.Add(new string(c, 1));
}
list.GroupPickerItemsSource = groupPickerItems;
list.GroupDescriptors.Add(groupBy);
list.SortDescriptors.Add(sortBy);
if (args.ViewType == MainViewType.Favorites)
list.GroupPickerItemTap += FavoriteJumpListGroupPickerItemTap;
else if (args.ViewType == MainViewType.Scenes)
list.GroupPickerItemTap += SceneJumpListGroupPickerItemTap;
else if (args.ViewType == MainViewType.Devices)
list.GroupPickerItemTap += DeviceJumpListGroupPickerItemTap;
list.GroupHeaderTemplate = (DataTemplate)this.Resources["AlphabeticGroupHeaderTemplate"];
list.GroupPickerItemTemplateSelector = (DataTemplateSelector)this.Resources["PhoneBookStyleGroupPickerItemTemplateSelector"];
list.GroupPickerItemsPanel = (ItemsPanelTemplate)this.Resources["PhoneBookStyleGroupPickerItemsPanel"];
list.StickyHeaderTemplate = (DataTemplate)this.Resources["AlphabeticStickyHeaderTemplate"];
}
else if (args.GroupByType == MainViewGroupByType.Category || args.GroupByType == MainViewGroupByType.Room)
{
if (args.GroupByType == MainViewGroupByType.Category)
list.GroupDescriptors.Add(new GenericGroupDescriptor<VeraItem, string>(item => item.Category));
else
list.GroupDescriptors.Add(new GenericGroupDescriptor<VeraItem, string>(item => item.Room));
list.IsStickyHeaderEnabled = true;
list.GroupHeaderTemplate = (DataTemplate)this.Resources["GroupTemplate"];
list.GroupPickerItemTemplate = (DataTemplate)this.Resources["GroupPickerItemTemplate"];
list.GroupPickerItemStyle = (Style)this.Resources["GroupPickerItemStyle"];
list.GroupPickerItemsPanel = (ItemsPanelTemplate)this.Resources["NormalGroupPickerItemsPanel"];
list.StickyHeaderTemplate = (DataTemplate)this.Resources["GroupTemplate"];
}
RadJumpList list = null;
// determine which list to manipulate
if (args.ViewType == MainViewType.Favorites)
{
list = this.favoriteJumpList;
}
else if (args.ViewType == MainViewType.Scenes)
{
list = this.sceneJumpList;
}
else if (args.ViewType == MainViewType.Devices)
{
list = this.deviceJumpList;
}
// reset the template info
if (args.ViewType == MainViewType.Favorites)
list.GroupPickerItemTap -= FavoriteJumpListGroupPickerItemTap;
else if (args.ViewType == MainViewType.Scenes)
list.GroupPickerItemTap -= SceneJumpListGroupPickerItemTap;
else if (args.ViewType == MainViewType.Devices)
list.GroupPickerItemTap -= DeviceJumpListGroupPickerItemTap;
list.GroupHeaderTemplate = null;
list.GroupPickerItemsSource = null;
list.GroupPickerItemTemplate = null;
list.GroupPickerItemStyle = null;
list.GroupPickerItemTemplateSelector = null;
list.GroupPickerItemsPanel = null;
list.StickyHeaderTemplate = null;
list.GroupDescriptors.Clear();
list.SortDescriptors.Clear();
if (args.GroupByType == MainViewGroupByType.Alphabetical)
{
GenericGroupDescriptor<VeraItem, string> groupBy = new GenericGroupDescriptor<VeraItem, string>(item => Regex.IsMatch(item.Name.Substring(0, 1).ToLower(), "^[a-z]{1}$") ? item.Name.Substring(0, 1).ToLower() : "#");
GenericSortDescriptor<VeraItem, string> sortBy = new GenericSortDescriptor<VeraItem, string>(item => item.Name);
list.IsStickyHeaderEnabled = true;
string alphabet = "#abcdefghijklmnopqrstuvwxyz";
List<string> groupPickerItems = new List<string>(32);
foreach (char c in alphabet)
{
groupPickerItems.Add(new string(c, 1));
}
list.GroupPickerItemsSource = groupPickerItems;
list.GroupDescriptors.Add(groupBy);
list.SortDescriptors.Add(sortBy);
if (args.ViewType == MainViewType.Favorites)
list.GroupPickerItemTap += FavoriteJumpListGroupPickerItemTap;
else if (args.ViewType == MainViewType.Scenes)
list.GroupPickerItemTap += SceneJumpListGroupPickerItemTap;
else if (args.ViewType == MainViewType.Devices)
list.GroupPickerItemTap += DeviceJumpListGroupPickerItemTap;
list.GroupHeaderTemplate = (DataTemplate)this.Resources["AlphabeticGroupHeaderTemplate"];
list.GroupPickerItemTemplateSelector = (DataTemplateSelector)this.Resources["PhoneBookStyleGroupPickerItemTemplateSelector"];
list.GroupPickerItemsPanel = (ItemsPanelTemplate)this.Resources["PhoneBookStyleGroupPickerItemsPanel"];
list.StickyHeaderTemplate = (DataTemplate)this.Resources["AlphabeticStickyHeaderTemplate"];
}
else if (args.GroupByType == MainViewGroupByType.Category || args.GroupByType == MainViewGroupByType.Room)
{
if (args.GroupByType == MainViewGroupByType.Category)
list.GroupDescriptors.Add(new GenericGroupDescriptor<VeraItem, string>(item => item.Category));
else
list.GroupDescriptors.Add(new GenericGroupDescriptor<VeraItem, string>(item => item.Room));
list.IsStickyHeaderEnabled = true;
list.GroupHeaderTemplate = (DataTemplate)this.Resources["GroupTemplate"];
list.GroupPickerItemTemplate = (DataTemplate)this.Resources["GroupPickerItemTemplate"];
list.GroupPickerItemStyle = (Style)this.Resources["GroupPickerItemStyle"];
list.GroupPickerItemsPanel = (ItemsPanelTemplate)this.Resources["NormalGroupPickerItemsPanel"];
list.StickyHeaderTemplate = (DataTemplate)this.Resources["GroupTemplate"];
}