22 lines
672 B
C#
Raw Normal View History

2025-08-15 16:34:31 +08:00
using System.Collections;
using System.Windows.Controls;
using Telerik.Windows.Controls;
namespace SWS.CAD.Views.CustomControl
{
public class RowNumberColumn : GridViewDataColumn
{
public override System.Windows.FrameworkElement CreateCellElement(Telerik.Windows.Controls.GridView.GridViewCell cell, object dataItem)
{
TextBlock textBlock = cell.Content as TextBlock;
if (textBlock == null)
{
textBlock = new TextBlock();
}
textBlock.Text = ((this.DataControl.ItemsSource as IList).IndexOf(dataItem) + 1).ToString();
return textBlock;
}
}
}