Copy this code and paste it in your HTML
private void Button_Click(object sender, RoutedEventArgs e)
{
Thread t
= new Thread
(new ThreadStart
(tuwas
));
t.Start();
}
public void tuwas()
{
this.Dispatcher.Invoke(DispatcherPriority.Normal, (Action)(() =>
{
myStackPanel.
Children.
Add(new Button
());
}));
}