开发者

Enumerate through Grid cell in WPF

I have Grid with 10 rows and 10 column, and I want in code behind get to every of this grid cell to change this background or add image to cell, How can 开发者_运维知识库I do it ?


Grid, in WPF, doesn't really have "cells".

Instead, individual child controls of the grid are "decorated" with the Grid.Row and Grid.Column attached property.

If you want to change the color of a "cell", there will need to be some UIElement that is marked with that row and column, and is a child of the Grid. You can search the grid's Children for the specific control in that row and column (by using Grid.GetColumn(child), etc), then set the color of that UIelement.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜