Phil
Phil

Reputation: 2446

UniformGrid adding Buttons over C#

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

Upvotes: 1

Views: 3810

Answers (1)

Bas
Bas

Reputation: 27105

PATH_DataGrid.Children.Add(b)

That will add the button to the panel.

Upvotes: 3

Related Questions