Browse by Tags

All Tags » Data binding (RSS)

Binding to enum’s

Maximilian asked the following question on Stack Overflow: Databinding an enum property to a ComboBox in WPF ? Let’s create a very simple example public enum EmployeeType { Manager, Worker } Each employee can either be a Manager or a Worker… Here is my Employee “model” public class Employee : BindableObject { private string name; public string Name { get { return name; } set { name = value ; RaisePropertyChanged( "Name" ); } } private string surname; public string Surname { get { return...
Posted by rudi | 3 comment(s)
Filed under: , ,

WPF + ADO?

If you have a WinForms background, you are sure to have used ADO.NET! One of the question I get asked is how do I bind to ADO.NET, LINQ, etc... Here is a very basic example of how to bind to ADO.NET objects. Note: I am using the standard AdventureWorks database available from CodePlex. My Window XAML only has a ListBox < ListView x : Name ="listBox" /> Here is my connection string and my SQL query const string connectionString = @"Data Source=rudi-lt\sqlexpress;Initial Catalog...
Posted by rudi | 1 comment(s)
Filed under: , ,