Click here to Skip to main content
15,897,371 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: WPF Update UI When Collection Changes Pin
Kevin Marois1-Aug-12 12:23
professionalKevin Marois1-Aug-12 12:23 
GeneralRe: WPF Update UI When Collection Changes Pin
Pete O'Hanlon1-Aug-12 12:45
mvePete O'Hanlon1-Aug-12 12:45 
GeneralRe: WPF Update UI When Collection Changes Pin
Kevin Marois1-Aug-12 12:51
professionalKevin Marois1-Aug-12 12:51 
GeneralRe: WPF Update UI When Collection Changes Pin
Mycroft Holmes1-Aug-12 13:10
professionalMycroft Holmes1-Aug-12 13:10 
GeneralRe: WPF Update UI When Collection Changes Pin
Kevin Marois1-Aug-12 13:27
professionalKevin Marois1-Aug-12 13:27 
GeneralRe: WPF Update UI When Collection Changes Pin
Kevin Marois6-Aug-12 7:25
professionalKevin Marois6-Aug-12 7:25 
GeneralRe: WPF Update UI When Collection Changes Pin
Mycroft Holmes6-Aug-12 12:38
professionalMycroft Holmes6-Aug-12 12:38 
GeneralRe: WPF Update UI When Collection Changes Pin
SledgeHammer011-Aug-12 13:15
SledgeHammer011-Aug-12 13:15 
Kevin Marois wrote:
That's a tremendous amount of code in many entities just to support WPF.

 
One possibility is in the WPF UI simple reload the list from data.


As Pete mentioned, your AddressEntity needs to implement INotifyPropertyChanged. Well, actually, I hope you have all that encapsulated in a base class and you just derive everything from ObservableObject or whatever Smile | :) .

In regards to your idea of reloading the list, that'll only work on the surface level, but it'll break a LOT of things. Lets say you have a collection tied to a ListBox or whatever and the user has Item5 selected and clicks the edit button and changes the name to Item5a. The way you have it now, the ListBox will continue to display Item5 because INotifyPropertyChanged was not implemented. So you'd try to refresh the entire list, now you'll run into an issue where Item5a has lost its selection, the h & v scroll positions will be lost as well, etc. Not a good UI when that happens Smile | :) .

Anyways... if you aren't using EF, how many properties are we talking about? 5, 10, 50, 100?

I think if it was 5 to 10, I would just hand job it with c&p... but if it started to get closer to 50 or 100 or more, I would probably just write a quick & dirty C# app that loaded up your .cs file and simply parsed each line. The return type would be the 2nd value and the property name would be the 3rd value. Your app can then auto-gen all the WPF code. Probably a 10 to 20 minute job tops to whip out a C# app that does that.

Nothing wrong with a non WPF app using the code since the PropertyChanged event will be null, your handler will just return.
GeneralRe: WPF Update UI When Collection Changes Pin
Kevin Marois1-Aug-12 13:32
professionalKevin Marois1-Aug-12 13:32 
GeneralRe: WPF Update UI When Collection Changes Pin
Mycroft Holmes1-Aug-12 14:17
professionalMycroft Holmes1-Aug-12 14:17 
GeneralRe: WPF Update UI When Collection Changes Pin
SledgeHammer011-Aug-12 15:49
SledgeHammer011-Aug-12 15:49 
GeneralRe: WPF Update UI When Collection Changes Pin
Kevin Marois1-Aug-12 17:33
professionalKevin Marois1-Aug-12 17:33 
GeneralRe: WPF Update UI When Collection Changes Pin
SledgeHammer011-Aug-12 17:46
SledgeHammer011-Aug-12 17:46 
GeneralRe: WPF Update UI When Collection Changes Pin
Kevin Marois2-Aug-12 13:39
professionalKevin Marois2-Aug-12 13:39 
GeneralRe: WPF Update UI When Collection Changes Pin
SledgeHammer012-Aug-12 14:08
SledgeHammer012-Aug-12 14:08 
GeneralRe: WPF Update UI When Collection Changes Pin
Pete O'Hanlon1-Aug-12 22:13
mvePete O'Hanlon1-Aug-12 22:13 
GeneralRe: WPF Update UI When Collection Changes Pin
Kevin Marois2-Aug-12 6:31
professionalKevin Marois2-Aug-12 6:31 
GeneralRe: WPF Update UI When Collection Changes Pin
Gerry Schmitz2-Aug-12 8:40
mveGerry Schmitz2-Aug-12 8:40 
GeneralRe: WPF Update UI When Collection Changes Pin
Kevin Marois2-Aug-12 8:47
professionalKevin Marois2-Aug-12 8:47 
GeneralRe: WPF Update UI When Collection Changes Pin
Gerry Schmitz2-Aug-12 9:05
mveGerry Schmitz2-Aug-12 9:05 
GeneralRe: WPF Update UI When Collection Changes Pin
Ed Hill _5_2-Aug-12 23:02
Ed Hill _5_2-Aug-12 23:02 
GeneralRe: WPF Update UI When Collection Changes Pin
Pete O'Hanlon2-Aug-12 9:47
mvePete O'Hanlon2-Aug-12 9:47 
GeneralRe: WPF Update UI When Collection Changes Pin
Gerry Schmitz2-Aug-12 9:55
mveGerry Schmitz2-Aug-12 9:55 
GeneralRe: WPF Update UI When Collection Changes Pin
Kevin Marois2-Aug-12 9:57
professionalKevin Marois2-Aug-12 9:57 
GeneralRe: WPF Update UI When Collection Changes Pin
Pete O'Hanlon2-Aug-12 10:21
mvePete O'Hanlon2-Aug-12 10:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.