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.Items.IndexOf(dataItem) + 1).ToString(); 
            textBlock.Text = ((this.DataControl.ItemsSource as IList).IndexOf(dataItem) + 1).ToString();

            return textBlock;
        }
    }
<telerik:RadGridView>
    <telerik:RadGridView.Columns>
        <local:RowNumberColumn Width="32" Header="序号"/>
     </telerik:RadGridView.Columns>
</telerik:RadGridView>

 

相关文章:

  • 2022-02-02
  • 2021-07-15
  • 2021-11-09
  • 2021-09-21
  • 2022-12-23
  • 2021-12-10
  • 2022-02-08
猜你喜欢
  • 2022-12-23
  • 2022-01-26
  • 2021-12-12
  • 2022-12-23
  • 2022-12-23
  • 2021-12-28
  • 2021-12-04
相关资源
相似解决方案