Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
假设我们在另一个网格中有 gind,父网格有很多子网格,基于它们我们的网格得到一些实际的宽度高度。我需要的只是将得到的实际宽度修复为我的网格宽度,我该怎么做?我试图将宽度绑定到实际宽度本身,但现在结果很糟糕。
谢谢
据我了解,您想检索父级的大小而不定义它,当您这样做时,您会得到一个 NaN 值。您必须先更新 Grid 的布局,如下所示:
parentGrid.UpdateLayout(); double with = parentGrid.ActualWidth;