I define some listview that each row contain 2 button.
Each button contain text that exist in the sql server database.
I want to bind the button text to the database – but i don’t know how to do it because of the special listview structure.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You should set the ItemsSource property of the ListView (any particular reason you’re not using a ListBox?) to a collection containing domain models which have been populated by the database. If you are using codebehind, then you can use listViewName.ItemsSource = myListOfDomainObjects. If you are using MVVM, then expose a property on your viewmodel, and use a binding expression in the XAML.
If your domain model has an e.g. ‘Name’ string property, then you can use this as the button text in your ItemTemplate by using: