WPF - 在代码隐藏的网格中更改控件的位置 [英] WPF - Change the place of a control in a grid in code-behind
本文介绍了WPF - 在代码隐藏的网格中更改控件的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以从代码隐藏更改控件在网格中的放置位置?
Is it possible to change where a control is placed in a grid from code-behind?
例如,如果我在 Grid.Row="1" 中有一个 Button,我可以将其从代码隐藏更改为 Grid.Row="0" 吗?
For example, if I have a Button in Grid.Row="1", can I change that to Grid.Row="0" from code-behind?
推荐答案
是的.走吧:
Grid.SetRow(button,0);
其中按钮是要更改的元素.
where button is the element to change.
这篇关于WPF - 在代码隐藏的网格中更改控件的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文