UniformGrid adding Buttons over C#

3.7k views Asked by At

I have in my WPF a UniformGrid

<UniformGrid Height="144" HorizontalAlignment="Left" Margin="0,136,0,0" VerticalAlignment="Top" Width="213" MaxHeight="144" MaxWidth="213" MinHeight="144" MinWidth="213" x:Name="PATH_DataGrid" Columns="7" Rows="6">
</UniformGrid>

and I will add some autogeneretet Buttons over C# cod to it

Button b = new Button();
            b.Content = "22";
            b.Width = 100;
            b.Height = 100;

Ho can I add the button to the UniformGrid??

        PATH_DataGrid`???

THX for you help

1

There are 1 answers

0
Bas On BEST ANSWER
PATH_DataGrid.Children.Add(b)

That will add the button to the panel.