So I want to add x buttons this value is going to be from a variable that is inputed by the user
I put like 5 tables and 5 buttons will appear.
Any help?
Asked
Active
Viewed 294 times
0

nvoigt
- 75,013
- 26
- 93
- 142

Joao Paulo
- 21
- 4
-
Read a good book? We cannot teach programming, that's way to broad for our format. Do you have a specific question, are you stuck at a specific problem *that you tried to solve yourself first*? Post your best try. – nvoigt Apr 18 '16 at 16:35
-
2Take a look at http://stackoverflow.com/questions/5929710/dynamically-add-multiple-buttons-to-wpf-window to see how to dynamically add buttons. ...possible duplicate. – David Oesterreich Apr 18 '16 at 16:35
1 Answers
1
Sounds like you want an ItemsControl. It let's you define a template (in your case, a button) and bind to a collection of items like this:
<ItemsControl ItemsSource={Binding MyCollectionOfObjects>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button Content="{Binding MyStringProperty}"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>

Joe
- 6,773
- 2
- 47
- 81