SelectedValue not working?

2 posts, 0 answers
  1. Rob Ainscough
    Rob Ainscough avatar
    172 posts
    Member since:
    Jan 2010

    Posted 30 Aug 2012 Link to this post

    I seem unable to get SelectedValue binding (to object) to work consistantly.

    I've read a million and one threads of people have similar problems and have tried all the possible solutions.  Even ones that suggest I re-arrange the order of my XAML making sure ItemsSource if first.  I've tried Microsoft's, both will not work.   I've checked the Collection values and everything to make sure there is a valid match ... nothing seems to work?

    I'm doing a standard Lookup type ComboBox where I bind on SelectedValue rather than SelectedItem as my source object is not the same as the Lookup objects I populate the ComboBox with.

    What's really frustrating is that I'm not getting ANY errors on Binding, my ComboBox will populate with values but I can't get them to have a SelectedValue (shows up blank).  SelectedItem works, SelectedIndex works, but SelectedValue does not.

    Biggest problem I have is that I don't get any errors, there's no place for me to go to try and figure out why this just doesn't work.  And what's even more frustrating is that it sometimes ONE ComboBox will work while the other's will not.

    Any hints or suggestions are appreciated.

    Thanks, Rob.

  2. Rob Ainscough
    Rob Ainscough avatar
    172 posts
    Member since:
    Jan 2010

    Posted 31 Aug 2012 Link to this post

    UPDATE: Found the solution, it was my fault, sorta.  I was setting SelectedValue = value of type Long where the ComboBox object SelectedValuePath was of type Integer.

    Oddly this didn't trigger any Binding errors so debugging this was much more involved that is probably should have been.

    Rob
  3. DevCraft banner
Back to Top