<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Trainning.Mycombobox"
x:Name="Window"
Title="Mycombobox"
Width="640" Height="480">
<Grid x:Name="LayoutRoot">
<ComboBox x:Name="com_friends" Height="32" Margin="223,102,264,0" VerticalAlignment="Top">
<ComboBoxItem Content="Chandru"/>
<ComboBoxItem Content="Arul"/>
<ComboBoxItem Content="Anbu"/>
</ComboBox>
</Grid>
在上面的代码中,我在组合框中添加了三个项目。之后,我将一项动态添加到同一个组合框中。这是我写的代码。
public partial class Mycombobox : Window
{
public Mycombobox()
{
this.InitializeComponent();
// Insert code required on object creation below this point.
com_friends.Items.Add("Bala");
}
}
它的输出将是这样的
但我想在“Anbu”和“Arul”之间添加项目“Bala”。这可能吗?
请帮我...