Click here to Skip to main content
15,891,567 members
Home / Discussions / WPF
   

WPF

 
QuestionHow to Make Buttons Pin
twoplass9-Dec-13 19:59
twoplass9-Dec-13 19:59 
SuggestionRe: How to Make Buttons Pin
thatraja16-Dec-13 0:36
professionalthatraja16-Dec-13 0:36 
GeneralWPF with Entity Framework. Pin
mishamit6-Dec-13 3:31
mishamit6-Dec-13 3:31 
GeneralRe: WPF with Entity Framework. Pin
Vincent Beek26-Feb-14 20:51
Vincent Beek26-Feb-14 20:51 
GeneralRe: WPF with Entity Framework. Pin
mishamit27-Feb-14 10:28
mishamit27-Feb-14 10:28 
QuestionWPF User Control Revisited Pin
Kevin Marois4-Dec-13 8:08
professionalKevin Marois4-Dec-13 8:08 
AnswerRe: WPF User Control Revisited - Figured it out, with one question though... Pin
Kevin Marois4-Dec-13 10:49
professionalKevin Marois4-Dec-13 10:49 
GeneralRe: WPF User Control Revisited - Figured it out, with one question though... Pin
Jason Gleim4-Dec-13 13:01
professionalJason Gleim4-Dec-13 13:01 
If you need info from the user that is required and is simple, then yes, I think it is OK to open it from the code behind. Remember, the separation of concerns in MVVM is to support testing of the VMs and the models independent of the view. So if you need to pop an input box or a file dialog or something from the control's code-behind, then go ahead if that is what makes the most sense.

That being said... although I think it is OK to do if that is what it takes to solve the problem, I think you are taking out some technical debt if you do it this way. You may want to reconsider your whole approach a bit. Normally, you would want the view model to react to a change in state in the view. With a control in the view you would normally want it to react to a change in the properties on the VM it is bound to. So generally, you would enter a state whereby a new employee needs picked, the VM might open a window to get the selection from the user. Then you would validate that result (in the VM) and set the property on the VM that your control is bound to so it can display the information. Generally we try to keep the brains out of the controls because that complicates things and makes it harder to maintain. The control should basically be able to take some information and display it. Any logic more than that should generally be in the VM.

And as one last thought... does your control need to know anything about the backend data other than being bound to a collection of the available options? Meaning, is there any logic in the control to manipulate the backing data such that there is a dependency on the backing data? Or, in other words, do you have strongly-typed references to data objects in your code behind? If so, that is definitely wrong. (References to members as part of the data template in code or in xaml don't count)

HTH.
QuestionHow to Set RadProgress bar on method load Pin
ramkie3-Dec-13 18:19
ramkie3-Dec-13 18:19 
AnswerRe: How to Set RadProgress bar on method load Pin
Mycroft Holmes3-Dec-13 18:53
professionalMycroft Holmes3-Dec-13 18:53 
QuestionPass values between windows Pin
shers2-Dec-13 6:35
shers2-Dec-13 6:35 
AnswerRe: Pass values between windows Pin
Elman905-Dec-13 23:02
Elman905-Dec-13 23:02 
AnswerRe: Pass values between windows Pin
Andy41120-Dec-13 2:36
Andy41120-Dec-13 2:36 
Questionhow to access cell template control's in listview in wpf Pin
dharmaa.m1-Dec-13 7:20
dharmaa.m1-Dec-13 7:20 
AnswerRe: how to access cell template control's in listview in wpf Pin
Mycroft Holmes1-Dec-13 11:48
professionalMycroft Holmes1-Dec-13 11:48 
GeneralRe: how to access cell template control's in listview in wpf Pin
dharmaa.m1-Dec-13 22:03
dharmaa.m1-Dec-13 22:03 
AnswerRe: how to access cell template control's in listview in wpf Pin
Varsha Ramnani1-Dec-13 23:15
professionalVarsha Ramnani1-Dec-13 23:15 
GeneralRe: how to access cell template control's in listview in wpf Pin
dharmaa.m2-Dec-13 0:32
dharmaa.m2-Dec-13 0:32 
GeneralRe: how to access cell template control's in listview in wpf Pin
Varsha Ramnani2-Dec-13 1:10
professionalVarsha Ramnani2-Dec-13 1:10 
QuestionHow to send the parent name when we click on chlid Pin
Ashfaque Hussain29-Nov-13 3:41
Ashfaque Hussain29-Nov-13 3:41 
QuestionCreate two window by silverlight for windows embeded compact7 os Pin
yingkou21-Nov-13 2:09
yingkou21-Nov-13 2:09 
AnswerRe: Create two window by silverlight for windows embeded compact7 os Pin
Mycroft Holmes21-Nov-13 11:48
professionalMycroft Holmes21-Nov-13 11:48 
GeneralRe: Create two window by silverlight for windows embeded compact7 os Pin
yingkou23-Nov-13 18:02
yingkou23-Nov-13 18:02 
QuestionTrouble with MultiTrigger and IsMouseOver property Pin
t2b18-Nov-13 10:28
t2b18-Nov-13 10:28 
QuestionScroll Bar is not showing Pin
Ashfaque Hussain18-Nov-13 1:56
Ashfaque Hussain18-Nov-13 1:56 

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.