问题
Is it possible to change where a control is placed in a grid from code-behind?
For example, if I have a Button in Grid.Row="1", can I change that to Grid.Row="0" from code-behind?
回答1:
Yes. Just go:
Grid.SetRow(button,0);
where button is the element to change.
来源:https://stackoverflow.com/questions/3785572/wpf-change-the-place-of-a-control-in-a-grid-in-code-behind