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. Databinding to a property which is a collection.

Databinding to a property which is a collection.

Scheduled Pinned Locked Moved WPF
wpfwcfsaleshelpquestion
3 Posts 2 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.
  • D Offline
    D Offline
    ddecoy
    wrote on last edited by
    #1

    I found no answer to this problem yet. I have a Collection with customer data. One of the properties of the customer class is a collection of addresses. I can bind these collection of addresses to a combobox or listbox with the ItemsSource property. But what I really want to do is bind some of these addresses to different textboxes. ex:

    TextBox1.Text="{binding Customer.Addresses.Address[0]}"
    TextBox2.Text="{binding Customer.Addresses.Address[1]}"
    ...

    I hope this is possible... Also is it possible to sort or filter in this binding scenario? Many thanks for your thoughts.

    P 1 Reply Last reply
    0
    • D ddecoy

      I found no answer to this problem yet. I have a Collection with customer data. One of the properties of the customer class is a collection of addresses. I can bind these collection of addresses to a combobox or listbox with the ItemsSource property. But what I really want to do is bind some of these addresses to different textboxes. ex:

      TextBox1.Text="{binding Customer.Addresses.Address[0]}"
      TextBox2.Text="{binding Customer.Addresses.Address[1]}"
      ...

      I hope this is possible... Also is it possible to sort or filter in this binding scenario? Many thanks for your thoughts.

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

      ddecoy wrote:

      TextBox1.Text="{binding Customer.Addresses.Address[0]}" TextBox2.Text="{binding Customer.Addresses.Address[1]}"

      I suspect you mean this:

      <TextBox Text="{Binding Customer.Addresses[0].Address}" />
      <TextBox Text="{binding Customer.Addresses[1].Address}" />

      "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

      D 1 Reply Last reply
      0
      • P Pete OHanlon

        ddecoy wrote:

        TextBox1.Text="{binding Customer.Addresses.Address[0]}" TextBox2.Text="{binding Customer.Addresses.Address[1]}"

        I suspect you mean this:

        <TextBox Text="{Binding Customer.Addresses[0].Address}" />
        <TextBox Text="{binding Customer.Addresses[1].Address}" />

        "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

        D Offline
        D Offline
        ddecoy
        wrote on last edited by
        #3

        Yes. But is it possible ?

        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