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而不进行拼接,但它可以正常工作。
选择仅在绿色区域中单击了工作。点击红色区域什么也不做。
是什么导致了这种情况,我该如何解决?
在此先感谢!