GrapeCity.Xaml.SpreadSheet.Data Namespace > Worksheet Class : BindDataColumn Method |
class item { public int Series1 { get; set; } public int Series2 { get; set; } public item(int series1, int series2) { Series1 = series1; Series2 = series2; } } item[] table = new item[3] { new item(2, 1), new item(4, 2), new item(3, 4) }; private void Button_Click_1(object sender, RoutedEventArgs e) { gcSpreadSheet1.Sheets[0].DataSource = table; gcSpreadSheet1.Sheets[0].DataAutoHeadings = true; gcSpreadSheet1.Sheets[0].BindDataColumn(1, "Series0"); gcSpreadSheet1.Sheets[0].Columns[0].DataField = "Series1"; } private void Button_Click_2(object sender, RoutedEventArgs e) { Boolean r; Boolean c; string colinfo; //object colinfo1; r = gcSpreadSheet1.Sheets[0].IsRowBound(0); c = gcSpreadSheet1.Sheets[0].IsColumnBound(0); colinfo = gcSpreadSheet1.Sheets[0].GetDataColumnName(1); //colinfo1 = gcSpreadSheet1.Sheets[0].GetColumnDataType(1); listBox1.Items.Add(r.ToString()); listBox1.Items.Add(r.ToString()); listBox1.Items.Add(colinfo.ToString()); //ListBox1.Items.Add(colinfo1.ToString()); }
Class item Public Property Series1() As Integer Get Return m_Series1 End Get Set(value As Integer) m_Series1 = Value End Set End Property Private m_Series1 As Integer Public Property Series2() As Integer Get Return m_Series2 End Get Set(value As Integer) m_Series2 = Value End Set End Property Private m_Series2 As Integer Public Sub New(series1__1 As Integer, series2__2 As Integer) Series1 = series1__1 Series2 = series2__2 End Sub End Class Private table As item() = New item(2) {New item(2, 1), New item(4, 2), New item(3, 4)} gcSpreadSheet1.Sheets(0).DataSource = table gcSpreadSheet1.Sheets(0).DataAutoHeadings = True gcSpreadSheet1.Sheets(0).BindDataColumn(1, "Series0") gcSpreadSheet1.Sheets(0).Columns(0).DataField = "Series1" Private Sub Button_Click_1(sender As Object, e As RoutedEventArgs) Dim r As Boolean Dim c As Boolean Dim colinfo As String 'Dim colinfo1 As Object r = gcSpreadSheet1.Sheets(0).IsRowBound(0) c = gcSpreadSheet1.Sheets(0).IsColumnBound(0) colinfo = gcSpreadSheet1.Sheets(0).GetDataColumnName(1) 'colinfo1 = gcSpreadSheet1.Sheets(0).GetColumnDataType(1) ListBox1.Items.Add(r.ToString()) ListBox1.Items.Add(r.ToString()) ListBox1.Items.Add(colinfo.ToString()) 'ListBox1.Items.Add(colinfo1.ToString()) End Sub
Target Platforms: Windows Server 2012, Windows RT