|
I have code in my view that reacts to a double-click on a listview so that the next successive parent of the SelectedItem being double-clicked is displayed. At the same time, other listviews which are synchronized to the SelectedItem(a ViewModel) of the listview being clicked shows the related ViewModel records.
How can I best separate this out in MVVM so there is no code in my view?
|
|
|
|
|
You could start by reading the prologue at the top of this page.
|
|
|
|
|
Richard MacCutchan wrote: prologue I can't see that word without hearing Frankie Howerd's voice.
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|
|
'Ere, no, listen, er ... and you, mush.
|
|
|
|
|
1) Learn to read.
2) Learn to pay attention. It's in red letters at the top of the page - it's not like we hide it in a footnote!
3) Then ask in the right place, and you might not annoy the people you want help from...http://www.codeproject.com/Questions/ask.aspx[^]
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Checkout the articles on this site, there are many. Just search for MVVM under articles in the search tool. I think trying to solve your problem on your own, with the aid of these articles, is the best way for you to learn; which is what this site is all about.
As you already see, their are some senior members here who are not so polite to those who post questions in the sacred Lounge. Sorry for that. Best of luck.
|
|
|
|
|
To get to the Lounge to post his question, he would start at the Home page, and go via the menu.
Past "Articles" - where he could find an answer.
Past "Quick Answers" - where he could get an answer.
Past "Discussions" - where he could get an answer.
To "Community", then to the Lounge - where it says clearly at the top of the page in bright red writing "click here to ask your programming question"
So if he misses all those subtle clues, a little mild rebuke is probably the least of his problems!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
You can come off your high horse now.
|
|
|
|
|
I never use horses - smelly big objects with no brakes and less brains!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Slacker007 wrote: You can come off your high horse now.
FTFY
Once you lose your pride the rest is easy.
In the end, only three things matter: how much you loved, how gently you lived, and how gracefully you let go of things not meant for you. – Buddha
Simply Elegant Designs JimmyRopes Designs
|
|
|
|
|
Actually
OriginalGriff wrote: To "Community", then to the Lounge
If you just click the community main menu you automatically come to the lounge.
Taken that into consideration it might sometimes make people just skip the rest and just ask the community.
Of course no excuse for not reading the big red letters but...
Tom
|
|
|
|
|
Ah, but what if he's Jewish!
Them awkward buggers read from right to left -- something that makes absolutely no sense to me whatsoever. It's totally illogical.
Must be why they're all lawyers.
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|
|
It makes sense if you are left handed...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Mark_Wallace wrote: Ah, but what if he's Jewish! Them awkward buggers read from right to left -- something that makes absolutely no sense to me whatsoever. It's totally illogical. Must be why they're all lawyers.
The most common languages written right to left are Arabic, Persian, and Urdu, not Hebrew.
http://en.wikipedia.org/wiki/Right-to-left[^]
Would you care to amend your remarks, in this light?
If you have an important point to make, don't try to be subtle or clever. Use a pile driver. Hit the point once. Then come back and hit it again. Then hit it a third time - a tremendous whack.
--Winston Churchill
|
|
|
|
|
Not at all!
If I've got a choice between facts that I make up or facts that wikipedia makes up, I'll choose my invented facts, any day!
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|
|
Slacker007 wrote: members here who are not so polite to those who post questions in the sacred Lounge It's nothing to do with being sacred, it's about reading and thinking, before randomly dumping a message. Something far too many people these days seem incapable of doing for themselves.
|
|
|
|
|
David Ceder wrote: How can I best separate this out in MVVM so there is no code in my view?
First off, you need to learn how interrupts work on an x86 architecture CPU. Once you've mastered that, you should learn about user mode threads (see here[^], I should get a 5 for this post just for that link).
Once you've mastered all that, you still need to figure out how to get the actual address in memory of you ViewModel -- a combination of fixed and P/Invoke should help.
Now you've got the pieces in place for writing a user thread monitor to check for changes in your ViewModel and call other functions to update when the data changes. Oops, I forgot to mention, you'll have to figure out how get the address of functions in the IL, and how to marshal back onto the main thread because the UI really shouldn't be updated on a worker thread.
Gads. So much work for something that would be so easy to do if the C# language designers had simply implemented property change events.
Marc
|
|
|
|
|
I assume you're asking how you can accomplish this without code-behind, rather than no code in your view at all. XAML is code.
What you're looking to do is to create a command in your ViewModel using one of the many ICommand implementations around, such as Josh Smith's RelayCommand. Once you have the command, you're going to need an EventToCommand implementation (there's one available in the System.Windows.Interactivity assembly) that you will bind the double-click on the ListView to your command.
|
|
|
|
|
|
Rage wrote: To break a myth that French girls do not like to be tied up.
FTFY
Once you lose your pride the rest is easy.
In the end, only three things matter: how much you loved, how gently you lived, and how gracefully you let go of things not meant for you. – Buddha
Simply Elegant Designs JimmyRopes Designs
|
|
|
|
|
Why do I have a feeling that your message is related to both your sig and your surname.
|
|
|
|
|
I did get the name from a group of biker girls that used to, shall we say, sunbathe on a boat in a marina where I used to live.
Once you lose your pride the rest is easy.
In the end, only three things matter: how much you loved, how gently you lived, and how gracefully you let go of things not meant for you. – Buddha
Simply Elegant Designs JimmyRopes Designs
|
|
|
|
|
Mid life crisis?
Peter Wasser
"The whole problem with the world is that fools and fanatics are always so certain of themselves, and wiser people so full of doubts." - Bertrand Russell
|
|
|
|
|
Now, more than ever, I want a job on Mythbusters[^].
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|
|
Not I: the last series didn't even have Kari Byron on - and without her it's a lot poorer. Visually, I mean.
Mind you, Tory wasn't there either which was an improvement.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|