private void SG1_AutoGeneratingColumn(object sender, SpreadAutoGeneratingColumnEventArgs e) { string headername = e.Column.Header.ToString(); //Cancel the column you don't want to generate if (headername == "MiddleName") { e.Cancel = true; } //update column details when generating if (headername == "FirstName") { e.Column.Header = "First Name"; } else if (headername == "LastName") { e.Column.Header = "Last Name"; } else if (headername == "EmailAddress") { e.Column.Header = "Email"; } }
Private Sub SG1_AutoGeneratingColumn(sender As Object, e As SpreadAutoGeneratingColumnEventArgs) Dim headername As String = e.Column.Header.ToString() 'Cancel the column you don't want to generate If headername = "MiddleName" Then e.Cancel = True End If 'update column details when generating If headername = "FirstName" Then e.Column.Header = "First Name" ElseIf headername = "LastName" Then e.Column.Header = "Last Name" ElseIf headername = "EmailAddress" Then e.Column.Header = "Email" End If End Sub
<sg:GcSpreadGrid Name="SG1" ItemsSource="{Binding}" AutoGenerateColumns="True" AutoGeneratingColumn="SG1_AutoGeneratingColumn" />