I'm experiencing som strange behaviour by the Silverlight ComboBox. I started out with some simple code:
xaml:
<ComboBox Name="drpInstallation" SelectionChanged="drpInstallation_SelectionChanged" />
cs:
List<string> installations = new List<string>();
installations.Add("Testing 123");
installations.Add("Antoher test");
installations.Add("Yeah");
drpInstallation.ItemsSource = installations;
Everything works well when clicking an item. However, if I use the ItemTemplate in ComboBox like this:
xaml:
<ComboBox Name="drpInstallation" SelectionChanged="drpInstallation_SelectionChanged">
<ComboBox.ItemTemplate>
<DataTemplate>
<ComboBoxItem Content="{Binding Installation}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
cs:
ICollection<InstallationClass> installations = a list of the installation class;
drpInstallation.ItemsSource = installations;
InstallationClass.cs:
public class InstallationClass
{
public int PK;
public string Installation;
}
Now the ComboBox displays correctly, however when I click the text if the items nothing happens. If I click just right of the text itself then the item is selected like normal. Point is; the natural thing to do is to click the text itself, not to the left or right of it. Any idea why this happens, and any idea how to correct it? Is this a Silverlight bug ?