0

I have a grid (table) like structure with rows and columns, and I am assigning the background color for every cell using the border object.

How do I change the background color for every cell of the grid?

This is my approach:

  • Delete the border object and assign it a new one.

  • I have also tried to create a new Border object, and add it. But it throws InvalidOperationException stating "Element is already the child of another element".

How can I change the background color for a particular table row?

4

1 に答える 1

2

あなたの質問をよりよく理解できるようになりました...

次のコードは、 Rowrと Columnに境界線を表示しますc

var border = myGrid.Children.OfType<Border>().Where(x => Grid.GetRow(x) == r && Grid.GetColumn(x) == c).FirstOrDefault();
border.Background = [...];

お役に立てれば。

于 2012-09-24T11:13:29.603 に答える