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?
-
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– nvoigt2016-04-18 16:35:10 +00:00Commented Apr 18, 2016 at 16:35
-
2Take a look at stackoverflow.com/questions/5929710/… to see how to dynamically add buttons. ...possible duplicate.David Oesterreich– David Oesterreich2016-04-18 16:35:53 +00:00Commented Apr 18, 2016 at 16:35
Add a comment
|
1 Answer
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>