Exemplo n.º 1
0
        protected void OnHeaderClicked(DataGridColumnModel <TItem> col)
        {
            var match = this.GetSortedColumns().FirstOrDefault(s => s.PropertyName.Equals(col.PropertyName, StringComparison.OrdinalIgnoreCase));

            if (match != null)
            {
                SortType currSortType = match.CurrentSortType,
                         newSortType  = SortType.None;

                if (currSortType == SortType.None || currSortType == SortType.Ascending)
                {
                    newSortType = SortType.Descending;
                }
                else
                {
                    newSortType = SortType.Ascending;
                }

                _debug += $"Sorting - current:{currSortType}, new:{newSortType} ";

                //reset the other columns' sorts
                ResetSorts();

                match.SetSortType(newSortType);
                _debug += $"sortcheck: {match.CurrentSortType} ";
            }
            UpdateCurrentItems();
        }
Exemplo n.º 2
0
        protected string GetItemCell(DataGridColumnModel <TItem> column, DataGridRow <TItem> row)
        {
            var value       = GetItemValue(column.PropertyName, row.Item);
            var valueString = value.ToString();

            return(valueString);
        }
Exemplo n.º 3
0
 public void AddColumn(DataGridColumnModel <TItem> col)
 {
     _debug += $"Column added - {col.PropertyName} ";
     this.Columns.Add(col);
     UpdatePropertyMappings();
     UpdateCurrentItems();
 }
Exemplo n.º 4
0
        protected bool IsColumnSortable(DataGridColumnModel <TItem> col)
        {
            var sortableCols = this.GetSortedColumns();
            var result       = sortableCols.Any(s => s.PropertyName.Equals(col.PropertyName, StringComparison.OrdinalIgnoreCase));

            _debug += $"is {col.PropertyName} sortable? {result} ";
            return(result);
        }
Exemplo n.º 5
0
 public void RemoveColumn(DataGridColumnModel <TItem> col)
 {
     _debug += "Column removed ";
     this.Columns.Remove(col);
 }