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. ObservableCollection

ObservableCollection

Scheduled Pinned Locked Moved WPF
question
7 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.
  • R Offline
    R Offline
    RugbyLeague
    wrote on last edited by
    #1

    I have an ObservableCollection bound to a list box - the collection is essentially ObservableCollection where Person has 2 properties: Name and Age. How do I bind the currently selected item in the listbox to some textboxes (seperate from the ListBox) which show the Name and Age of the Person and allow the Name and Age to be updated using the TextBoxes?

    P N 2 Replies Last reply
    0
    • R RugbyLeague

      I have an ObservableCollection bound to a list box - the collection is essentially ObservableCollection where Person has 2 properties: Name and Age. How do I bind the currently selected item in the listbox to some textboxes (seperate from the ListBox) which show the Name and Age of the Person and allow the Name and Age to be updated using the TextBoxes?

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

      The easy way to do this is to set IsSynchronizedWithCurrentItem="True" on your listview. This way, the currently selected item is synchronised with the collection.

      "WPF has many lovers. It's a veritable porn star!" - Josh Smith

      As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

      My blog | My articles | MoXAML PowerToys | Onyx

      M 1 Reply Last reply
      0
      • P Pete OHanlon

        The easy way to do this is to set IsSynchronizedWithCurrentItem="True" on your listview. This way, the currently selected item is synchronised with the collection.

        "WPF has many lovers. It's a veritable porn star!" - Josh Smith

        As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

        My blog | My articles | MoXAML PowerToys | Onyx

        M Offline
        M Offline
        mark_w_
        wrote on last edited by
        #3

        check this out http://windowsclient.net/learn/video.aspx?v=149522[^] Its about validation, but also show what you want to do. you can also download the source

        P 1 Reply Last reply
        0
        • M mark_w_

          check this out http://windowsclient.net/learn/video.aspx?v=149522[^] Its about validation, but also show what you want to do. you can also download the source

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

          Thanks for that, but I already know what to do. I assume you meant to link this to the OP rather than me.

          "WPF has many lovers. It's a veritable porn star!" - Josh Smith

          As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

          My blog | My articles | MoXAML PowerToys | Onyx

          M 1 Reply Last reply
          0
          • P Pete OHanlon

            Thanks for that, but I already know what to do. I assume you meant to link this to the OP rather than me.

            "WPF has many lovers. It's a veritable porn star!" - Josh Smith

            As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

            My blog | My articles | MoXAML PowerToys | Onyx

            M Offline
            M Offline
            mark_w_
            wrote on last edited by
            #5

            Sorry, thought it backed up your comment of using IsSynchronizedWithCurrentItem="True"

            R 1 Reply Last reply
            0
            • M mark_w_

              Sorry, thought it backed up your comment of using IsSynchronizedWithCurrentItem="True"

              R Offline
              R Offline
              RugbyLeague
              wrote on last edited by
              #6

              I saw it - thanks.

              modified on Monday, May 11, 2009 12:48 PM

              1 Reply Last reply
              0
              • R RugbyLeague

                I have an ObservableCollection bound to a list box - the collection is essentially ObservableCollection where Person has 2 properties: Name and Age. How do I bind the currently selected item in the listbox to some textboxes (seperate from the ListBox) which show the Name and Age of the Person and allow the Name and Age to be updated using the TextBoxes?

                N Offline
                N Offline
                Niladri_Biswas
                wrote on last edited by
                #7

                Set IsSynchronizedWithCurrentItem="True" I agree :)

                Niladri Biswas

                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