how would i add multiple buttons to a window in c#? here\'s what i need to do... i\'m getting multiple user values from a dictionary (within reason, only @ 5-6 values). for
Consider you have a StackPanel named sp
for(int i=0; i<5; i++)
{
System.Windows.Controls.Button newBtn = new Button();
newBtn.Content = i.ToString();
newBtn.Name = "Button" + i.ToString();
sp.Children.Add(newBtn);
}
To remove button you could do
sp.Children.Remove((UIElement)this.FindName("Button0"));
Hope this help.