Click here to Skip to main content
15,351,370 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: Conditional DataBinding to UI Elements Pin
Mycroft Holmes5-Feb-12 0:58
professionalMycroft Holmes5-Feb-12 0:58 
GeneralRe: Conditional DataBinding to UI Elements Pin
SledgeHammer015-Feb-12 7:53
MemberSledgeHammer015-Feb-12 7:53 
GeneralRe: Conditional DataBinding to UI Elements Pin
Mycroft Holmes5-Feb-12 11:01
professionalMycroft Holmes5-Feb-12 11:01 
GeneralRe: Conditional DataBinding to UI Elements Pin
SledgeHammer015-Feb-12 11:49
MemberSledgeHammer015-Feb-12 11:49 
GeneralRe: Conditional DataBinding to UI Elements Pin
Mycroft Holmes5-Feb-12 12:15
professionalMycroft Holmes5-Feb-12 12:15 
GeneralRe: Conditional DataBinding to UI Elements Pin
SledgeHammer015-Feb-12 12:26
MemberSledgeHammer015-Feb-12 12:26 
GeneralRe: Conditional DataBinding to UI Elements Pin
Mycroft Holmes5-Feb-12 13:15
professionalMycroft Holmes5-Feb-12 13:15 
GeneralRe: Conditional DataBinding to UI Elements Pin
SledgeHammer015-Feb-12 14:14
MemberSledgeHammer015-Feb-12 14:14 
Mycroft Holmes wrote:
Yeah that is one of the main drawbacks. I often throw all the conditional tests
into 1 method and call that from multiple events. Which is basically what you
are doing in xaml duh!
 
I can see some research into triggers are
going to be needed!


One other thought I had about your approach while I was watching TV was that unless you **really** know the VM and its view bindings and how everything works together, you run the real risk of un-necessary / unintentional (and potentially expensive) screen updates.

By "throwing multiple updates in to one function" as you said, you could unintentionally trigger updates for say a few hundred properties when you just updated one. Maybe not on purpose Smile | :) , but by accident.

By doing this via triggers and self enforcing the rule that only the setter for PropertyA is allowed to put up a OnPropertyChanged("PropertyA") notification (and nothing else), you really mitigate this risk and optimize screen updates. All your setters should of course have "if (_theProp != value) { }" checks.

Now, with my trigger example where I bind to 4 properties in a multivalue converter, and I only change one of them, yeah, its going to call the converter function again, but the other 3 values are already cached by WPF. Also, there is very little overhead as the converter instance is cached as well, so you aren't recreating it.

Heck, you don't even need to do it that way. If your conditions are "basic", you can have a multiple condition trigger without the use of a converter at all.

The reason I had to use a converter there was because the logic that returned 1,2,3,4 or 5 was more complex then XAML allowed.
GeneralRe: Conditional DataBinding to UI Elements Pin
Mycroft Holmes5-Feb-12 15:15
professionalMycroft Holmes5-Feb-12 15:15 
AnswerRe: Conditional DataBinding to UI Elements Pin
Mycroft Holmes5-Feb-12 15:16
professionalMycroft Holmes5-Feb-12 15:16 
GeneralRe: Conditional DataBinding to UI Elements Pin
Andy_L_J5-Feb-12 15:43
MemberAndy_L_J5-Feb-12 15:43 
QuestionOwn TreeViewItem with image and text Pin
Mc_Topaz2-Feb-12 22:20
MemberMc_Topaz2-Feb-12 22:20 
AnswerRe: Own TreeViewItem with image and text Pin
Mc_Topaz3-Feb-12 0:52
MemberMc_Topaz3-Feb-12 0:52 
GeneralGridSplitter Conundrum Pin
Gil Yoder1-Feb-12 15:31
MemberGil Yoder1-Feb-12 15:31 
QuestionRe: GridSplitter Conundrum Pin
Gil Yoder2-Feb-12 9:44
MemberGil Yoder2-Feb-12 9:44 
AnswerRe: GridSplitter Conundrum Pin
SledgeHammer012-Feb-12 11:40
MemberSledgeHammer012-Feb-12 11:40 
GeneralRe: GridSplitter Conundrum Pin
Gil Yoder2-Feb-12 14:09
MemberGil Yoder2-Feb-12 14:09 
GeneralRe: GridSplitter Conundrum Pin
SledgeHammer012-Feb-12 14:37
MemberSledgeHammer012-Feb-12 14:37 
GeneralRe: GridSplitter Conundrum Pin
Gil Yoder2-Feb-12 15:43
MemberGil Yoder2-Feb-12 15:43 
SuggestionRe: GridSplitter Conundrum Pin
Gil Yoder2-Feb-12 18:59
MemberGil Yoder2-Feb-12 18:59 
GeneralRe: GridSplitter Conundrum Pin
SledgeHammer013-Feb-12 7:17
MemberSledgeHammer013-Feb-12 7:17 
Questionadding/removing ListView columns at runtime (revisited) Pin
Vincent Beek1-Feb-12 0:20
MemberVincent Beek1-Feb-12 0:20 
AnswerRe: adding/removing ListView columns at runtime (revisited) Pin
Abhinav S1-Feb-12 0:36
MemberAbhinav S1-Feb-12 0:36 
GeneralRe: adding/removing ListView columns at runtime (revisited) Pin
Mycroft Holmes1-Feb-12 11:53
professionalMycroft Holmes1-Feb-12 11:53 
QuestionBinding list of items to IntemsControl in WPF Pin
rams230-Jan-12 23:14
Memberrams230-Jan-12 23:14 

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.