Another MVVM questionn regarding updating info on other controls? - [Answered]
-
Still trying to grasp MVVM here. I have 4 controls I display from my main form. Basically
How can I update say messages for the status bar when things occur inside one of the other controls. Lets say On the RibbonControl there is a button to open the database. The code to open it would include references to displaying a message on the statusbar control that the form is loading and also update the title of the form to display the path of the database, name and title of the application. Now I can do this in regular WPF but their is code behind I'm trying to understand how to do this in MVVM.
-
Still trying to grasp MVVM here. I have 4 controls I display from my main form. Basically
How can I update say messages for the status bar when things occur inside one of the other controls. Lets say On the RibbonControl there is a button to open the database. The code to open it would include references to displaying a message on the statusbar control that the form is loading and also update the title of the form to display the path of the database, name and title of the application. Now I can do this in regular WPF but their is code behind I'm trying to understand how to do this in MVVM.
Most people doing this would use either a Messenger or a Mediator. These are common techniques that play nicely with MVVM.
*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington
"Mind bleach! Send me mind bleach!" - Nagy Vilmos
CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier
-
Still trying to grasp MVVM here. I have 4 controls I display from my main form. Basically
How can I update say messages for the status bar when things occur inside one of the other controls. Lets say On the RibbonControl there is a button to open the database. The code to open it would include references to displaying a message on the statusbar control that the form is loading and also update the title of the form to display the path of the database, name and title of the application. Now I can do this in regular WPF but their is code behind I'm trying to understand how to do this in MVVM.
Using Binding on your StatusBarControl will helps you.
Christian Amado MCITP | MCTS | MOS | MTA DCE 0★ 1★ 2★ 3★ 4★ 5★ Bronze level MVA Olimpia ☆ ★★★
-
Using Binding on your StatusBarControl will helps you.
Christian Amado MCITP | MCTS | MOS | MTA DCE 0★ 1★ 2★ 3★ 4★ 5★ Bronze level MVA Olimpia ☆ ★★★
I'm not sure I understand. How would binding allow me to display something like, Management Mode - Contacts Manager - Editing Contacts? Or Management Mode - Contacts Manager - Create New Contact?
-
I'm not sure I understand. How would binding allow me to display something like, Management Mode - Contacts Manager - Editing Contacts? Or Management Mode - Contacts Manager - Create New Contact?
Bind the controls text property to a property (VMProp) in your VM, update VMProp with the status you need to display. That update is driven by the processes in the VM that are initiate by the user.
Never underestimate the power of human stupidity RAH
-
Bind the controls text property to a property (VMProp) in your VM, update VMProp with the status you need to display. That update is driven by the processes in the VM that are initiate by the user.
Never underestimate the power of human stupidity RAH
I think I understand. I've noticed that MVVM is basically Bind everything lol.
-
I think I understand. I've noticed that MVVM is basically Bind everything lol.
Alisaunder wrote:
MVVM is basically Bind everything
You have that absolutely correct. No more code to manipulate the UI directly, everything is in the VM, or converters etc
Never underestimate the power of human stupidity RAH
-
Using Binding on your StatusBarControl will helps you.
Christian Amado MCITP | MCTS | MOS | MTA DCE 0★ 1★ 2★ 3★ 4★ 5★ Bronze level MVA Olimpia ☆ ★★★
Unless the OP is using a single VM, you have missed important information out. How is another unrelated control going to be updated? If you see my answer, you can see the common mechanisms which answers the question the OP actually asked.
*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington
"Mind bleach! Send me mind bleach!" - Nagy Vilmos
CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier