本文整理汇总了C#中System.Windows.Controls.GroupStyle.HeaderStringFormat属性的典型用法代码示例。如果您正苦于以下问题:C# GroupStyle.HeaderStringFormat属性的具体用法?C# GroupStyle.HeaderStringFormat怎么用?C# GroupStyle.HeaderStringFormat使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类System.Windows.Controls.GroupStyle
的用法示例。
在下文中一共展示了GroupStyle.HeaderStringFormat属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Convert
// The converter to group the items.
public class GroupByPrice : IValueConverter
{
public object Convert(object value,
Type targetType,
object parameter,
System.Globalization.CultureInfo culture)
{
if (!(value is double))
{
return null;
}
double itemPrice = (double)value;
if (itemPrice < 100)
{
return 100;
}
if (itemPrice < 250)
{
return 250;
}
if (itemPrice < 500)
{
return 500;
}
return 1000;
}
public object ConvertBack(object value,
Type targetType,
object parameter,
System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}
// The type of objects that are added to the ItemsControl.
public class PurchaseItem
{
public string Description { get; set; }
public double Price { get; set; }
public DateTime OfferExpires { get; set; }
public PurchaseItem()
{
}
public PurchaseItem(string desc, double price, DateTime endDate)
{
Description = desc;
Price = price;
OfferExpires = endDate;
}
public override string ToString()
{
return String.Format("{0}, {1:c}, {2:D}", Description, Price, OfferExpires);
}
}
// The source of the ItemsControl.
public class ItemsForSale : ObservableCollection<PurchaseItem>
{
public ItemsForSale()
{
Add((new PurchaseItem("Snowboard and bindings", 120, new DateTime(2009, 1, 1))));
Add((new PurchaseItem("Inside C#, second edition", 10, new DateTime(2009, 2, 2))));
Add((new PurchaseItem("Laptop - only 1 year old", 499.99, new DateTime(2009, 2, 28))));
Add((new PurchaseItem("Set of 6 chairs", 120, new DateTime(2009, 2, 28))));
Add((new PurchaseItem("My DVD Collection", 15, new DateTime(2009, 1, 1))));
Add((new PurchaseItem("TV Drama Series", 39.985, new DateTime(2009, 1, 1))));
Add((new PurchaseItem("Squash racket", 60, new DateTime(2009, 2, 28))));
}
}