2

I have a MainGrid in Wpf (not a DataGrid) it has 3 rows(0.1 and 2) i have made rows using xaml at design time now at run time behind a menu button i want to add 2 column to row 1 of the main grid.

The hard part is that only break the row 1 into 2 columnn and not the whole Grid.

i know that to add new rows and columns one can use rowdefination and columndefination but

couldnt find anything here:

 MainGrid.RowDefinitions.ElementAt(1).SetValue...;

Thanks

2 Answers 2

3

Why don't you add a Grid with 1 row and 2 columns to that row instead. And put your contents in that Grid. That will be easier.

Sign up to request clarification or add additional context in comments.

3 Comments

yeah tried it, GridView newGrid = new GridView (); Grid.SetRow(newGrid, 1);
but its giving argument cannot convert errot
yeah got it working thanks. Grid newGrid = new Grid (); Grid.SetRow(newGrid, 1); Grid.SetColumn(newGrid, 1); MainGrid.Children.Add(newGrid);
1

make the column span = 2 for all the controls that you add in row 2 and 3...

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.