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.
如何在不从第一行删除控件然后将其添加到第二行的情况下将控件从 Grid 的一行移动到另一行???
谢谢
假设您想在运行时执行此操作,在代码隐藏中,您可以尝试:
// Assuming your control is not in row 1 myControl.SetValue(Grid.RowProperty, 1)
为什么?要轻松完成此操作,您必须更改它所在的行。
另一种方法是使用数学计算网格、行和控件的高度并按边距定位。- 非常混乱的代码。