TheJoeIaut
TheJoeIaut

Reputation: 1532

Dynamic Databinding in WPF

I am filling up a Stackpanel with Textboxes. Each textbox, Should display the Value Property of a Class i have written.

The number of Textboxes is always different so i can't create a databinding in the xaml file.

Are there tutorials, that show how can i archive my goal?

Edit: Thanks for the replies so far. After reading the articles i still not clear how to implement my Problem.

Here is what I'm trying to achieve:

I have an SQL Server DB and there a Table with an ID and a Value.

I now load all Values and IDs i want to display into my application. (number of loaded rows is always differnt).

I need to display a textbox for each row and display the value there and after the value is changed i write the value back to the database.

I don't know how I should query the data and than bind it to the textboxes.

I don't need an implementations, I am happy with every piece of advice I can get.

Upvotes: 1

Views: 2423

Answers (2)

paparazzo
paparazzo

Reputation: 45096

If your class, classValue, has a public property Value then just create a List and bind that to a ListBox with the item DisplayValuePath = Value. Repeater controls are used to bind to collections.

Upvotes: 0

rlcrews
rlcrews

Reputation: 3562

yes there are a number of tutorials out there. It sound like you are interested in datatemplating.

I would suggest looking Here on MSDN. A few tutorials on databinding in general may be useful DataBinding on MSDN

Upvotes: 1

Related Questions