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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. WPF
  4. WPF Listbox

WPF Listbox

Scheduled Pinned Locked Moved WPF
questionwpfcsharpwcf
4 Posts 3 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
    Drathmar
    wrote on last edited by
    #1

    I recently started the WPF and I came across a weird behavior in listboxes. I have it binding to a viewmodel object and displaying the view properly, even have it selecting the item properly. Sometimes those listbox have text boxes for my user to type in, and when they hit the F key, it moves to the next listbox item. After alot of digging I found out that it has to do with the name space of the item bound to the listbox. If I change the viewmodels class to "zsomename.folder.viewmodel" then when I type z in the text box it moves it to the next listbox item. Its like there's a built in behavior to select a matching listbox item base off the starting letter... but how do I remove this, or what is calling this. Anyone have any ideas?

    A D 2 Replies Last reply
    0
    • D Drathmar

      I recently started the WPF and I came across a weird behavior in listboxes. I have it binding to a viewmodel object and displaying the view properly, even have it selecting the item properly. Sometimes those listbox have text boxes for my user to type in, and when they hit the F key, it moves to the next listbox item. After alot of digging I found out that it has to do with the name space of the item bound to the listbox. If I change the viewmodels class to "zsomename.folder.viewmodel" then when I type z in the text box it moves it to the next listbox item. Its like there's a built in behavior to select a matching listbox item base off the starting letter... but how do I remove this, or what is calling this. Anyone have any ideas?

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

      That sounds weird. Can you paste a small code example here so we can reproduce this?

      [Forum Guidelines]

      1 Reply Last reply
      0
      • D Drathmar

        I recently started the WPF and I came across a weird behavior in listboxes. I have it binding to a viewmodel object and displaying the view properly, even have it selecting the item properly. Sometimes those listbox have text boxes for my user to type in, and when they hit the F key, it moves to the next listbox item. After alot of digging I found out that it has to do with the name space of the item bound to the listbox. If I change the viewmodels class to "zsomename.folder.viewmodel" then when I type z in the text box it moves it to the next listbox item. Its like there's a built in behavior to select a matching listbox item base off the starting letter... but how do I remove this, or what is calling this. Anyone have any ideas?

        D Offline
        D Offline
        Dave Kerr
        wrote on last edited by
        #3

        There is indeed built in behaviour to do this - however, your textbox shouldn't invoke this, are you using a datatemplate? Can you please post the XAML that creates the listbox and its items? I'm sure we can help out :) By the way the zsomename.folder.viewmodel is indeed why Z is selecting an item, however, if the keydown event in the textbox is bubbling then this needs to be address (bubbling events are those that at a point in the logical tree and move up).

        D 1 Reply Last reply
        0
        • D Dave Kerr

          There is indeed built in behaviour to do this - however, your textbox shouldn't invoke this, are you using a datatemplate? Can you please post the XAML that creates the listbox and its items? I'm sure we can help out :) By the way the zsomename.folder.viewmodel is indeed why Z is selecting an item, however, if the keydown event in the textbox is bubbling then this needs to be address (bubbling events are those that at a point in the logical tree and move up).

          D Offline
          D Offline
          Drathmar
          wrote on last edited by
          #4

          Well it came up because we have a list box inside a listbox. I was trying to make it so that when the user presses a letter "a,b,c,d,e,f... etc" it would select that given listbox subitem. Instead it move to the next question. So this is happening in the key down event and I need to handle it there? Or is there a better way of doing it?

          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