Sunday 15 February 2015

WPF Data Binding and Data from SQL DataTable - need some ideas -


I have a lot of WPF windows on them, I write some code on them, which adds UI control and data, something like that :

  public class addressWindow {public string addressID {get; Set; } Public string Addr1 {get; Set; } Public String Addr2 {get; Set; } Public string zip {get; Set; } Public String City {Received; Set; } Public String Mobile {Received; Set; } Public string fax {get; Set; } Public string country {get; Set; } Public String Email {get; Set; } Public string phone {get; Set; } Public Bull ISS System {Received; Set; } Enable Public Buttons {get; Set; }} Private Zero BindInCode () {var Address = New Address Window {// AddressID = "110", // Addr1 = "Kaunas", // Addr2 = "Jonavos", // ZIP = "8987", // City = "Mestas", // mobile = "869985868", / / ​​FAX = "87998", // country = "Lithuania", // email = "emailas@ree.lt", // phone = "37598288" , // IsSystem = true, // enabled = false}; Binding binding = new binding (); Binding Source = address; Binding.updatestrategor = updateSource Trigger Property changed; Binding.path = new propertypath ("address id"); This.db_AddressID.SetBinding (TextEdit.TextProperty, binding); Binding = new binding (); Binding Source = address; Binding.updatestrategor = updateSource Trigger Property changed; Binding.path = new propertypath ("AdR1"); This.db_Addr1.SetBinding (TextEdit.TextProperty, binding); ...............}  

Now I want to create some universal simple engine for filling data values ​​(value to my square properties from datatale Please, specify) ). Does anyone know how to do this ..? For example, there is a way of specifying value by the names of properties, say that the name of my property is equivalent to the name of the column from the Datasro. Is it possible to do something like this in WPF, or do not I have to manually do every window Assign value to?

Personally, I have used the code generation to work, but you can use it for Jimmy Bougard, what about you Talking it's on and off.


No comments:

Post a Comment