Click here to Skip to main content
15,887,683 members
Home / Discussions / WPF
   

WPF

 
QuestionAnother DependencyProperty Question Pin
Kevin Marois5-Sep-13 16:11
professionalKevin Marois5-Sep-13 16:11 
AnswerRe: Another DependencyProperty Question Pin
Pete O'Hanlon5-Sep-13 20:24
mvePete O'Hanlon5-Sep-13 20:24 
GeneralRe: Another DependencyProperty Question Pin
Kevin Marois6-Sep-13 3:50
professionalKevin Marois6-Sep-13 3:50 
GeneralRe: Another DependencyProperty Question Pin
SledgeHammer016-Sep-13 5:07
SledgeHammer016-Sep-13 5:07 
GeneralRe: Another DependencyProperty Question Pin
Jason Gleim6-Sep-13 5:23
professionalJason Gleim6-Sep-13 5:23 
GeneralRe: Another DependencyProperty Question Pin
Kevin Marois6-Sep-13 6:59
professionalKevin Marois6-Sep-13 6:59 
GeneralRe: Another DependencyProperty Question Pin
Jason Gleim6-Sep-13 7:28
professionalJason Gleim6-Sep-13 7:28 
GeneralRe: Another DependencyProperty Question Pin
Kevin Marois6-Sep-13 7:54
professionalKevin Marois6-Sep-13 7:54 
1) I started my original post with "I'm still struggling to understand DP's", so, no, I don't understand DP's, hence my post.

2) Your comments on the 'accepted method of implementing MVVM' are subjective. Just because I don't fully understand DP's doesn't mean I also don't understand WPF/MVVM. I've been doing MVVM for a long time with no problems. I just haven't used DP's and I thought I needed one here.

MVVM simply calls for a separation of concerns. So what concerns are we talking about? Data vs UI.

There's no law that states you can't put code in the code behind. The MVVM principle would not be violated if the code in the code behind was UI related. Do some Googling on "MVVM Code IN Code Behind" and you'll see lot's of discussions on folks putting UI code in the code behind to make their UI more functional.

Having said all that, I personally try to avoid code in the code behind simply because I don't see a need for it, and also because I don't want code in 2 places. But that doesn't make me a purist in any sense.

3) I'm not sure what you mean by "Normal developers put the DP code in the view model so it only gets instantiated once. But you probably don't agree with that mantra either."

a) I am a 'Normal developer' (I'm confused by this comment)
b) If the DP was in the View or VM - what would make it instantiate more than once?? My view's code behind and my VM's only ever instantiate once each. Again, confusing statement



I'm totally open to putting the DP in the VM. But when I've done that in the past it doesn't show up in the XAML. My JobListView control has the DP in the code behind. Therefore it's compiled into the same component. You of course know that the XAML and Code Behind are one, so putting the DP in the code behind allows it to be visible in the XAML of the view hosting the user control:

<views:JobListView Grid.Row="0"
                    SelectedJob="{Binding Path=SelectedJob, Mode=TwoWay}"/>


In this case, 'SelectedJob' is the DP defined in the JobListView code behind. Move the DP to the VM and this XAML is broken.

Again, all this is based on my limited knowledge of DB's. I have yet to see a decent tutorial on how to USE them. Not DEFINE them - USE them. There's a difference.

Thanks
If it's not broken, fix it until it is

GeneralRe: Another DependencyProperty Question Pin
Jason Gleim6-Sep-13 9:03
professionalJason Gleim6-Sep-13 9:03 
GeneralRe: Another DependencyProperty Question Pin
Kevin Marois6-Sep-13 9:40
professionalKevin Marois6-Sep-13 9:40 
GeneralRe: Another DependencyProperty Question Pin
Jason Gleim6-Sep-13 10:39
professionalJason Gleim6-Sep-13 10:39 
GeneralRe: Another DependencyProperty Question Pin
Jason Gleim6-Sep-13 10:53
professionalJason Gleim6-Sep-13 10:53 
GeneralRe: Another DependencyProperty Question Pin
Kevin Marois6-Sep-13 13:01
professionalKevin Marois6-Sep-13 13:01 
GeneralRe: Another DependencyProperty Question Pin
Kevin Marois9-Sep-13 7:12
professionalKevin Marois9-Sep-13 7:12 
GeneralRe: Another DependencyProperty Question Pin
Jason Gleim9-Sep-13 7:55
professionalJason Gleim9-Sep-13 7:55 
GeneralRe: Another DependencyProperty Question Pin
Kevin Marois9-Sep-13 8:01
professionalKevin Marois9-Sep-13 8:01 
GeneralRe: Another DependencyProperty Question Pin
Kevin Marois6-Sep-13 8:22
professionalKevin Marois6-Sep-13 8:22 
GeneralRe: Another DependencyProperty Question Pin
Pete O'Hanlon6-Sep-13 6:06
mvePete O'Hanlon6-Sep-13 6:06 
AnswerRe: Another DependencyProperty Question Pin
Richard Deeming6-Sep-13 4:22
mveRichard Deeming6-Sep-13 4:22 
GeneralRe: Another DependencyProperty Question Pin
SledgeHammer016-Sep-13 5:08
SledgeHammer016-Sep-13 5:08 
Questionneed a coah for a WPF projet Pin
vanjier4-Sep-13 6:17
vanjier4-Sep-13 6:17 
AnswerRe: need a coah for a WPF projet Pin
Pete O'Hanlon4-Sep-13 6:31
mvePete O'Hanlon4-Sep-13 6:31 
GeneralRe: need a coah for a WPF projet Pin
vanjier16-Sep-13 1:31
vanjier16-Sep-13 1:31 
GeneralRe: need a coah for a WPF projet Pin
Pete O'Hanlon16-Sep-13 1:50
mvePete O'Hanlon16-Sep-13 1:50 
AnswerRe: need a coah for a WPF projet Pin
Abhinav S9-Sep-13 7:15
Abhinav S9-Sep-13 7:15 

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.