Reputation: 9926
i need to move some button that exist in grid row 1 to grid row 2 in run time - in the code ..
How can i do it ?
Thanks
Upvotes: 0
Views: 3033
Reputation: 30514
Grid.Row
is a dependency property, so you could bind it to a property in your viewmodel if you're using MVVM.
<Button Grid.Row="{Binding Path=ButtonRow}" />
Upvotes: 1
Reputation: 84657
Use the attached property Grid.Row. Example
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="100"/>
<RowDefinition Height="100"/>
</Grid.RowDefinitions>
<Button Name="button"
Grid.Row="0"
Content="Some content"/>
</Grid>
Change row in code behind
Grid.SetRow(button, 1);
Upvotes: 3