本文整理匯總了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))));
}
}