Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WPF
  4. Another MVVM questionn regarding updating info on other controls? - [Answered]

Another MVVM questionn regarding updating info on other controls? - [Answered]

Scheduled Pinned Locked Moved WPF
wpfquestioncsharpdatabasearchitecture
8 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Alisaunder
    wrote on last edited by
    #1

    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.

    P C 2 Replies Last reply
    0
    • A Alisaunder

      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.

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • A Alisaunder

        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.

        C Offline
        C Offline
        Christian Amado
        wrote on last edited by
        #3

        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 ☆ ★★★

        A P 2 Replies Last reply
        0
        • C Christian Amado

          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 ☆ ★★★

          A Offline
          A Offline
          Alisaunder
          wrote on last edited by
          #4

          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?

          M 1 Reply Last reply
          0
          • A Alisaunder

            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?

            M Offline
            M Offline
            Mycroft Holmes
            wrote on last edited by
            #5

            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

            A 1 Reply Last reply
            0
            • M Mycroft Holmes

              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

              A Offline
              A Offline
              Alisaunder
              wrote on last edited by
              #6

              I think I understand. I've noticed that MVVM is basically Bind everything lol.

              M 1 Reply Last reply
              0
              • A Alisaunder

                I think I understand. I've noticed that MVVM is basically Bind everything lol.

                M Offline
                M Offline
                Mycroft Holmes
                wrote on last edited by
                #7

                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

                1 Reply Last reply
                0
                • C Christian Amado

                  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 ☆ ★★★

                  P Offline
                  P Offline
                  Pete OHanlon
                  wrote on last edited by
                  #8

                  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

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups