public static void OnDescriptorChanged(BindableObject bo, GroupDescriptorBase oldValue, GroupDescriptorBase newValue) { (bo as RadListView).PropertyChanged += (o, e) => { var listview = o as RadListView; if (e.PropertyName != RadListView.ItemsSourceProperty.PropertyName) { return; } var list = listview.ItemsSource as IList; if (list != null && list.Count > 0) { var descriptor = GroupDescriptorBehavior.GetDescriptor(listview) as GroupDescriptorBase; if (descriptor != null && !listview.GroupDescriptors.Contains(descriptor)) { listview.GroupDescriptors.Add(descriptor); } } else { var descriptor = GroupDescriptorBehavior.GetDescriptor(listview) as GroupDescriptorBase; if (descriptor != null) { listview.GroupDescriptors.Remove(descriptor); } } }; }
internal override void PrepareUI() { if (this.Owner == null || !this.IsTemplateApplied) { return; } this.Container.Owner = this.Owner.Owner; for (int i = 0; i < this.Owner.Owner.GroupDescriptors.Count; i++) { GroupDescriptorBase descriptor = this.Owner.Owner.GroupDescriptors[i]; DataGridFlyoutGroupHeader header = new DataGridFlyoutGroupHeader(); this.SetupDragDropProperties(header, i); header.DataContext = descriptor; header.CloseButtonClick += this.Owner.HandleGroupFlyoutHeaderClosed; header.DragSurfaceRequested += this.HandleDragSurfaceRequested; header.DescriptorContentTap += this.Owner.HandleGroupFlyoutDescriptorContentTap; header.ParentGrid = this.Owner.Owner; this.Container.Elements.Add(header); } int childCount = this.Container.Elements.Count; if (childCount > 0) { var lastHeader = this.Container.Elements[childCount - 1] as DataGridFlyoutGroupHeader; lastHeader.BottomGlyphOpacity = 0.0; } }
public override bool CanStartReorder(GroupDescriptorBase groupDescriptorBase) { if (!this.IsGroupHeaderReorderEnabled) { return(false); } return(base.CanStartReorder(groupDescriptorBase)); }
private void Grouping(object sender, GridViewGroupingEventArgs e) { if (e.Action == GroupingEventAction.Place) { var cgd = e.GroupDescriptor as ColumnGroupDescriptor; if (cgd != null && cgd.Column.UniqueName == "Date") { e.Cancel = true; if (grid.GroupDescriptors.OfType <GroupDescriptorBase>().Where(d => d.DisplayContent == "Year" || d.DisplayContent == "Month").Any()) { return; } AddCustomGroupDescriptors(); } } else if (e.Action == GroupingEventAction.Remove) { var gd = e.GroupDescriptor as GroupDescriptorBase; GroupDescriptorBase gdToRemove = null; if (gd != null) { if (gd.DisplayContent == "Year") { gdToRemove = grid.GroupDescriptors.OfType <GroupDescriptorBase>().Where(d => d.DisplayContent == "Month").FirstOrDefault(); } else if (gd.DisplayContent == "Month") { gdToRemove = grid.GroupDescriptors.OfType <GroupDescriptorBase>().Where(d => d.DisplayContent == "Year").FirstOrDefault(); } } if (gdToRemove != null) { grid.GroupDescriptors.Remove(gdToRemove); } } }
public static void SetDescriptor(BindableObject bo, GroupDescriptorBase value) { bo.SetValue(GroupDescriptorBehavior.DescriptorProperty, value); }
public void SetGroupDescriptor(GroupDescriptorBase groupDescriptor) { this.DataGrid.GroupDescriptors.Add(groupDescriptor); }