【发布时间】:2017-03-27 03:20:35
【问题描述】:
private void cbKlik_GotFocus(object sender, RoutedEventArgs e)
{
string[] izbira1 = { "Kingston 2, 5'' SSD disk 480 GB, SATA3", "DELL monitor LED UltraSharp U2412M", "Lenovo IdeaPad 110" };
string[] izbira2 = { "PCX namizni računalnik Exam i5-7400/8GB/SSD120+1TB/Win10H", "Lenovo prenosnik V310", "Intel procesor Core i7-5820K" };
string[] izbira3 = { "HP prenosnik Pavilion 17-ab004nm", "Intel procesor Core i7 6900K", "Gigabyte grafična kartica GTX 1080 OC" };
string[] izbira4 = { "Asus prenosnik FX502VM-DM311T", "HP prenosnik Omen 17-w103nm", "DELL prenosnik Alienware 17" };
ComboBox cmb = (ComboBox)sender;
int izbranIndex = cmb.SelectedIndex;
if (izbranIndex == 1)
{
lvDataBinding.Items.Clear();
}
//lvDataBinding.Items.Clear();
}
我想这样当我单击第一个组合框时,第一个数组中的字符串会添加到列表视图中。但是缺少一些东西,因为没有任何事情发生。 (Items.Clear 仅用于测试,我还将使用它来清除我在 WPF 中定义的以前的 listviewitems)。提前致谢!
【问题讨论】: