简体   繁体   English

在容器中修复网格的实际

[英]Fix Grid's actual with in container

Imagine we have gind in another grid , parent grid have many children , based on them our grid gets some actual width heights. 想象一下,我们在另一个网格中有一个gind,父网格中有许多子级,基于它们我们的网格会得到一些实际的宽度高度。 All i need is to fix getted actual width as my grids width, how can i do it? 我需要做的就是将获取的实际宽度固定为我的网格宽度,我该怎么办? I tried to bind width to actual width itself but result it terrible you now. 我试图将宽度本身绑定到实际宽度,但是现在使您感到可怕。

Thanks 谢谢

From what I understand , you want to retrieve the size of the parent without defining it, and when you do, you get an NaN value. 据我了解,您想在不定义父对象的情况下检索其大小,然后,您将获得一个NaN值。 You have to update the layout of the Grid first, like this : 您必须先更新Grid的布局,如下所示:

parentGrid.UpdateLayout();
double with = parentGrid.ActualWidth;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM