I want to avoid first item selection that happens by default in Listbox
when application loads. I tried with
SelectedIndex= -1
but it did not work. I do not want any item to be selected when ListBox
loads until user selects any item from Listbox
.
I have IsSynchronization
set to true but making it false
also do not solve my problem. Though i have to keep IsSychronization
set to true
always. But thats ok. i did google but could not find any relevant answer.
Can anyone tell me how to do this ?
I had this happen to me. When I bound ListBox.ItemsSource
directly to a collection in my view model, the re was nothing selected by default.
When I switched to using a CollectionViewSource
as the ListBox.ItemsSource
, suddenly the first item was getting selected by default.
It turns out this was due to ListBox.IsSynchronizedWithCurrentItem
. Setting that to
IsSynchronizedWithCurrentItem="False"
on the ListBox
restored the desired behavior of having nothing selected by default.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With