Reorder or Drag not working on gridview
-
Tuesday, May 01, 2012 8:41 AM
public class ChoiceSection { public String Name; public String Title { get { return Name; } } public Type pageType; } public class ChoiceSectionGroup { public ObservableCollection<ChoiceSection> _items = new ObservableCollection<ChoiceSection>(); public ObservableCollection<ChoiceSection> Items { get { return _items; } } public String Name; public String Title { get { return Name; } } public void Add(ChoiceSection section){ _items.Add(section); } } /// <summary> /// A page that displays a grouped collection of items. /// </summary> public sealed partial class SectionSelectionPage : Testx.Common.LayoutAwarePage { public SectionSelectionPage() { this.InitializeComponent(); } protected override void OnNavigatedTo(NavigationEventArgs e) { ObservableCollection<ChoiceSectionGroup> sectionsGroups = new ObservableCollection<ChoiceSectionGroup>(); ChoiceSectionGroup sectionGroup = new ChoiceSectionGroup(); ChoiceSection section; section = new ChoiceSection(); section.Name = "Test 0"; sectionGroup.Add(section); section = new ChoiceSection(); section.Name = "Test 1"; sectionGroup.Add(section); section = new ChoiceSection(); section.Name = "Test 2"; sectionGroup.Add(section); section = new ChoiceSection(); section.Name = "Test 3"; sectionGroup.Add(section); section = new ChoiceSection(); section.Name = "Custom Stations"; sectionGroup.Add(section); sectionsGroups.Add(sectionGroup); groupedItemsViewSource.Source = sectionsGroups; //this.DefaultViewModel["Groups"] = sectionsGroups; this.DefaultViewModel["Groups"] = groupedItemsViewSource.View; }With xaml:
<CollectionViewSource x:Name="groupedItemsViewSource" IsSourceGrouped="true" ItemsPath="Items"/>Previously, i was also binding "Groups" in the xaml and tried this one too.. it doesn't work: no reordering, no drop..
Gridview xaml:
<GridView x:Name="itemGridView" AutomationProperties.AutomationId="ItemGridView" AutomationProperties.Name="Grouped Items" Margin="116,0,40,46" ItemsSource="{Binding Source={StaticResource groupedItemsViewSource}}" ItemTemplate="{StaticResource Standard250x250ItemTemplate}" CanDragItems="True" CanReorderItems="True" AllowDrop="True">
All Replies
-
Tuesday, May 01, 2012 8:54 AMModerator
Hi ELRaymod,
As far as I know reorder/dragdrop is not supported for grouped items.
http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/07970ab8-3d24-4d5a-870d-be2b3f62665d
Best regards,
Min Zhu [MSFT]
MSDN Community Support | Feedback to us
- Marked As Answer by ELRaymod Tuesday, May 01, 2012 9:28 AM


