Silverlight ComboBox で奇妙な動作が発生しています。私はいくつかの簡単なコードから始めました:
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;
アイテムをクリックすると、すべてがうまく機能します。ただし、次のように ComboBox で ItemTemplate を使用すると:
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;
}
ComboBox が正しく表示されるようになりましたが、テキストをクリックしても項目が何も起こらないようになりました。テキスト自体のすぐ右をクリックすると、アイテムは通常どおり選択されます。ポイントは; 自然に行うことは、テキスト自体をクリックすることです。テキストの左または右ではありません。なぜこれが起こるのか、それを修正する方法はありますか?これは Silverlight のバグですか?