So this is pretty mystifying. I have a databound ListBox
(or ListView
, it happens with both), and if it has more than 2 items in it, selection works - I get a blue highlight bar and the item looks selected. If I only have 1 item, the selection does not work - I do not get a blue highlight bar, but the selection events all fire as normal. Is this a bug in WPF? Or am I just crazy?
This is how I'm setting up my ListBox
:
<ListView x:Name="plotListBox"
DockPanel.Dock="Bottom"
ItemsSource="{Binding Path=Plots}"
SelectedItem="{Binding Path=SelectedPlot, Mode=TwoWay}"
SelectionMode="Single"
ScrollViewer.CanContentScroll="False"/>
Has anyone else run into something like this? This post seems to describe a similar issue, but I can't find anything in the replies that I think would help my situation.