0
我創建了與ObservableCollection綁定的ComboBox。這是代碼。無法在UWP中的ComboBox中選擇項目
XAML
<StackPanel HorizontalAlignment="Center"
Grid.Row="0">
<TextBlock Text="Choose a city" />
<ComboBox x:Name="CityComboBox"
SelectionChanged="CityComboBox_SelectionChanged"
ItemsSource="{x:Bind cities}"
HorizontalAlignment="Center"
VerticalAlignment="Top">
<ComboBox.ItemTemplate>
<DataTemplate x:DataType="data:City">
<ComboBoxItem Content="{x:Bind name}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</StackPanel>
C#類
public class Grad
{
public String imeGrada { get; set; }
public ArrayList arr1 { get; set; }
public List<A> list1 { get; set; }
public City()
{
name = "NewYork";
arr1= new ArrayList();
list1 = new List<A>();
}
當我運行應用程序,我不能選擇ComboBoxItem點擊它的中心,但只能在該項目的優勢。如果我使用ComboBox而不進行拼接,但它可以正常工作。
選擇僅在綠色區域中單擊了工作。點擊紅色區域什麼也不做。
是什麼導致了這種情況,我該如何解決?
在此先感謝!