private void AssociatedObject_CustomGroupDisplayText(object sender, CustomGroupDisplayTextEventArgs e) { if (e.Column.FieldName == "ImdbRating" || e.Column.FieldName == "Item.VoteAverage" || e.Column.FieldName == "PersonalRating") { int groupValue = Convert.ToInt32(e.Value); e.DisplayText = groupValue.ToString(); } else if (e.Column.FieldName == "Item.Budget" || e.Column.FieldName == "Item.Revenue") { decimal groupValue = Math.Floor(Convert.ToDecimal(e.Value) / MoneyGroupInterval); decimal upperBound = (groupValue + 1) * MoneyGroupInterval; decimal lowerBound = groupValue * MoneyGroupInterval; string groupText = String.Format("{0:#,##0,,M $} - {1:#,##0,,M $} ", lowerBound, upperBound); if (lowerBound == 0) { groupText = String.Format(" <= {0:#,##0,,M $} ", MoneyGroupInterval); } if (lowerBound >= MoneyMaxValue) { groupText = String.Format(" >= {0:#,##0,,M $} ", MoneyMaxValue); } e.DisplayText = groupText; } else if (e.Column.FieldName == "Item.GenreIds" || e.Column.FieldName == "Starring") { e.DisplayText = e.DisplayText.FirstOfJoinedByListSeparator(); } }
private void AssociatedObject_CustomGroupDisplayText(object sender, CustomGroupDisplayTextEventArgs e) { if (e.Column.FieldName == "Size") { long size = Convert.ToInt64(e.Value); if (size == 0) { e.DisplayText = Properties.Resources.EmptyFiles; } else if (size < 1024) { e.DisplayText = String.Format(IntervalFormat, "Bytes"); } else if (size < 1048576) { e.DisplayText = String.Format(IntervalFormat, "KB"); } else if (size < 1073741824) { e.DisplayText = String.Format(IntervalFormat, "MB"); } else { e.DisplayText = String.Format(IntervalFormat, "GB"); } } else if (e.Column.FieldName == "Name") { if (Char.IsDigit(e.DisplayText[0])) { e.DisplayText = "0-9"; } else { e.DisplayText = e.DisplayText[0].ToString().ToUpper(); } } else if (e.Column.FieldType == typeof(DateTime)) { DateTime date = Convert.ToDateTime(e.Value); switch (e.Column.GroupInterval) { case ColumnGroupInterval.Date: case ColumnGroupInterval.DateRange: e.DisplayText = date.ToString("dd.MM.yyyy"); break; case ColumnGroupInterval.DateMonth: e.DisplayText = date.ToString("MMMM yyyy"); break; case ColumnGroupInterval.DateYear: e.DisplayText = date.ToString("yyyy"); break; } } }
void OnCustomGroupDisplayText(object sender, CustomGroupDisplayTextEventArgs e) { if (e.Column.FieldName != "UnitPrice") { return; } string interval = IntervalByValue(e.Value); e.DisplayText = interval; }
void view_CustomGroupDisplayText(object sender, CustomGroupDisplayTextEventArgs e) { if (e.Column.SortMode == ColumnSortMode.Custom) { double d = Math.Floor(Convert.ToDouble(e.Value) / 10); string ret = string.Format("{0:$0.00} - {1:$0.00} ", d * 10, (d + 1) * 10); if (d > 19) { ret = string.Format(">= {0:$0.00} ", d * 10); } e.DisplayText = ret; } }