I’m quite new to whole XAML thing.
I need to create a table (grid) with constant number of rows and columns (e.g 2×5) and put a TextBlock in each cell.
How can I do this properly, so I can change the data of cells easily?
for example, I want to create a function which accepts 1 integer as offset:
void fillDate(int offset)
and fills the cells starting from offset incrementally.
i.e. calling the function with `fillData(3)’ for a 2×5 would generate the following table:
| | |1|2
3|4|5|6|7
It’s nothing special, and coming from a Silverlight/XAML background, but will probably more or less work. You might need to tweak for slight API differences (writing in notepad without VS handy) and untested, but should give you what you need to get started.
EDIT: Just realized that you might be wanting a TextBlock with no text in the “empty” cells, in which case substitute the inner loop’s code with:
EDIT: Based on your comment, first run a method when you create your control to build the grid and populate all the textfields and store them in a listing of some sort:
Then subsequently run another method to alter the values as desired: