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. Bind current listbox selection to string property in parent window [modified]

Bind current listbox selection to string property in parent window [modified]

Scheduled Pinned Locked Moved WPF
debuggingquestion
2 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.
  • J Offline
    J Offline
    Jean Louis Leroy
    wrote on last edited by
    #1

    Hello, I have a window with a listbox bound to a User table in a DataSet, which displays the userid column: .... I managed to bind the current selection to a DataRowView property in the window: public DataRowView CurrentUser { set { System.Diagnostics.Trace.WriteLine(value); } } However, I'd like to bind to a string property: public string CurrentUser { set; private get; } ...so that I can read the currently selected userid easily via getCurrentUser(). Is that feasible ? Thanks, J-L -- Modified Thursday, March 31, 2011 11:16 AM

    M 1 Reply Last reply
    0
    • J Jean Louis Leroy

      Hello, I have a window with a listbox bound to a User table in a DataSet, which displays the userid column: .... I managed to bind the current selection to a DataRowView property in the window: public DataRowView CurrentUser { set { System.Diagnostics.Trace.WriteLine(value); } } However, I'd like to bind to a string property: public string CurrentUser { set; private get; } ...so that I can read the currently selected userid easily via getCurrentUser(). Is that feasible ? Thanks, J-L -- Modified Thursday, March 31, 2011 11:16 AM

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

      Is CurrentUser as row? If so then simply get the column value from the datarow. You may need another property or you may be able to bind to required columns value.

      Never underestimate the power of human stupidity RAH

      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