Just subj. Can't find how to do that without databindings.
I'm trying to do that simply like that:
maingrid.ColumnDefinitions.Add(col1);
DataGrid listOfExercises = new DataGrid();
listOfExercises.ItemsSource = GetDayExercises(ref time);
Grid.SetRowSpan(listOfExercises, maingrid.RowDefinitions.Count - 1);
Grid.SetColumn(listOfExercises, maingrid.ColumnDefinitions.Count - 1);
maingrid.Children.Add(listOfExercises);
GetDayExercises() returns int[]. I've got the next result:
Number of rows is the same as must be, but where are the numbers?
Looks like you miss Binding
. Try this:
DataGridTextColumn col1 = new DataGridTextColumn();
col1.Binding = new Binding();
dataGrid1.Columns.Add(col1);
dataGrid1.ItemsSource = Enumerable.Range(1, 10);
It shows datagrid with numbers from 1 to 10
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.