我想在 C# 中添加一个组合框,因为我不想一直添加相同的组合框。我的代码是我想添加的组合框。
<ScrollViewer Margin="252,130,296,134" Grid.Row="1" VerticalAlignment="Top" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollMode="Enabled" ScrollViewer.HorizontalScrollMode="Disabled" ScrollViewer.ZoomMode="Disabled">
<StackPanel >
<ItemsControl x:Name="ic" Grid.Row="2">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid HorizontalAlignment="Left" VerticalAlignment="Center">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<Border BorderBrush="#C83245" Background="White" BorderThickness="1">
<ComboBox x:Name="cbSeletion" VerticalAlignment="Center" FontSize="14" Width="250" Height="40" Foreground="Black" Tapped="cbSeletion_Tapped">
</ComboBox>
</Border>
<Border BorderBrush="#C83245" Background="White" BorderThickness="1">
<TextBlock Text="{Binding Name}" FontSize="14" VerticalAlignment="Center" Width="350" Foreground="Black"/>
</Border>
<Border BorderBrush="#C83245" Background="White" BorderThickness="1" >
<TextBlock Text="{Binding Position}" FontSize="14" VerticalAlignment="Center" Width="250" Foreground="Black"/>
</Border>
</StackPanel>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</ScrollViewer>
我该怎么做才能使用它?