listbox selectedindex when setting itemsource RRS feed

  • Question

  • I'm setting the itemsource for a listbox when the application is initialized and the listbox selects the first item in the list which causes selectionchanged to fire. I want the selectedindex to be -1 when the listbox is bound. I have tried setting the selectedindex to -1 after I set the itemsource but it's too late and selectionchanged fires again. Is it possible to not select an item when the listbox is bound?

    I have the datacontext for another element set to the selecteditem of my listbox and I don't want anything selected when the application is loaded.
    Monday, January 19, 2009 1:47 AM

All replies

  • Hi,

    Listbox has a property IsSynchronizedWithCurrentItem. Could you try setting it to "False"? That might work for you.

    Thanks, Harry Huang [MSFT]
    Saturday, January 31, 2009 12:43 AM