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. Binding a DataSet to a ListBox in a WPF XBAP application

Binding a DataSet to a ListBox in a WPF XBAP application

Scheduled Pinned Locked Moved WPF
wpfcsharpwcfhelptutorial
6 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.
  • N Offline
    N Offline
    Neeraj Kr
    wrote on last edited by
    #1

    Can anyone help me in letting me know how to bind a dataset to a listbox in a WPF XBAP application. The dataset contains a table with two columns.

    -----Have A Nice Day-----

    A R 2 Replies Last reply
    0
    • N Neeraj Kr

      Can anyone help me in letting me know how to bind a dataset to a listbox in a WPF XBAP application. The dataset contains a table with two columns.

      -----Have A Nice Day-----

      A Offline
      A Offline
      ABitSmart
      wrote on last edited by
      #2

      You bind the DataContext of the ListBox to the DataSet and set the ItemsSouce binding with Path as the tablename OR you directly bind the table to the ItemsSource property.

      N L 2 Replies Last reply
      0
      • A ABitSmart

        You bind the DataContext of the ListBox to the DataSet and set the ItemsSouce binding with Path as the tablename OR you directly bind the table to the ItemsSource property.

        N Offline
        N Offline
        Neeraj Kr
        wrote on last edited by
        #3

        Hi, Can you please provide me the code to set the ItemSource binding to the path as suggested by you.

        -----Have A Nice Day-----

        A 1 Reply Last reply
        0
        • N Neeraj Kr

          Hi, Can you please provide me the code to set the ItemSource binding to the path as suggested by you.

          -----Have A Nice Day-----

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

          1. Setting the DataSet to the DataContext and binding the ItemsSource using binding Path. e.g., In code setting the DataContext, yourListBox.DataContext= yourDataSet; in XAML setting ItemsSource binding, 2. Setting the DataTable directly to the ListBox's ItemsSource, yourListBox.ItemsSource = yourDataSet.Tables["YourTableName"];

          1 Reply Last reply
          0
          • A ABitSmart

            You bind the DataContext of the ListBox to the DataSet and set the ItemsSouce binding with Path as the tablename OR you directly bind the table to the ItemsSource property.

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            You bind the DataContext of the ListBox to the DataSet and set the ItemsSouce binding with Path as the tablename OR you directly bind the table to the ItemsSource property.

            dharmesh

            1 Reply Last reply
            0
            • N Neeraj Kr

              Can anyone help me in letting me know how to bind a dataset to a listbox in a WPF XBAP application. The dataset contains a table with two columns.

              -----Have A Nice Day-----

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

              Databinding - if you read 100 examples you will find 100 ways to do that databinding - pick one at random and give it a try - repeat until something works. That's what I do then I scrap the app anyway because WPF is always too slow and I am not a designer so everything looks rubbish.

              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