tags:

views:

21

answers:

2

Hello,

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);

Thanks for the answers!

A: 

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

Jacob Nelson
A: 

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

KeithMahoney