本文整理匯總了C#中System.Windows.Controls.DataGrid.RowHeaderStyle屬性的典型用法代碼示例。如果您正苦於以下問題:C# DataGrid.RowHeaderStyle屬性的具體用法?C# DataGrid.RowHeaderStyle怎麽用?C# DataGrid.RowHeaderStyle使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類System.Windows.Controls.DataGrid
的用法示例。
在下文中一共展示了DataGrid.RowHeaderStyle屬性的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Convert
public class ConvertItemToIndex : IValueConverter
{
#region IValueConverter Members
//Convert the Item to an Index
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
try
{
//Get the CollectionView from the DataGrid that is using the converter
DataGrid dg = (DataGrid)Application.Current.MainWindow.FindName("DG1");
CollectionView cv = (CollectionView)dg.Items;
//Get the index of the item from the CollectionView
int rowindex = cv.IndexOf(value)+1;
return rowindex.ToString();
}
catch (Exception e)
{
throw new NotImplementedException(e.Message);
}
}
//One way binding, so ConvertBack is not implemented
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
#endregion
}