ListBox always auto selects first item

remove IsSynchronizedWithCurrentItem="True" an add it with the next SelectionChanged event if needed. This solved my problem


Well i tried this using FocusManager.FocusedElement .. and made the intial focus to
listbox itself.. so it has the focus..but no element is selected.. if u press down or tab ..the 1st element of the listbox will be selected...

<Window
  ...... 
  FocusManager.FocusedElement="{Binding ElementName=listbox2}">
    <ListBox x:Name="listbox2" HorizontalAlignment="Left"
        VerticalAlignment="Bottom" Width="117.333" Height="116" 
        Margin="30.667,0,0,30">
        <ListBoxItem>Jim</ListBoxItem>
        <ListBoxItem>Mark</ListBoxItem>
        <ListBoxItem>Mandy</ListBoxItem>
</ListBox>

You could set SelectedIndex to -1 :

<ListBox ItemsSource="{Binding MyData}" SelectedIndex="-1"/>

Note: I want to do this with pure xaml, if you have any code-behind ideas then please don't bother yourself.

Unfortunately you can't do everything in XAML... you can usually avoid code-behind, but you still need to write converters, markup extensions or attached properties


Try

IsSynchronizedWithCurrentItem="False"