开发者

How to get a specific Grid's Row or Column Width and Height value?

In my application I have a Grid that is divided in two columns:

 instance_room[room_guid].Room_grid.ColumnDefinitions.Add(new ColumnDefinition());
 instance_room[room_guid].Room_grid.ColumnDefinitions.Add(new ColumnDefinition() { MinWidth = 130, MaxWidth = 250 });

To which I add I add a Canvas in the first one:

 Grid.SetColumn(instance_room[room_guid].Room_canvas, 0);

I would like after that to be able to retrieve, in code-behind, the width or height of my Column(0).

I tried many things, but none has worked properly, any answers?

Thank you, Ephismen.

[EDIT] Since I have children into my grid(0) I accessed it's width and height with:

temp_roomlist[tag[0]].Room_canvas.Height = (double)temp_roomlist[tag[0]].Room_canvas.Parent.GetValue(Grid.ActualHeightProperty开发者_JAVA技巧);

Thanks for the answers!


Cells/Columns/Rows do not have heights and/or widths unless you manually set their widths and/or heights.


Can you use Room_grid.ColumnDefinitions[0].Width?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜