获取 WPF 工具包 AutoCompleteBox 下拉列表中的项目数
Get Count of Items in WPF Toolkit AutoCompleteBox Dropdown
有没有办法获取当前显示在 WPF 工具包自动完成框下拉列表中的项目数?
处理 Populated
事件:
private void AutoCompleteBox_Populated(object sender, PopulatedEventArgs e)
{
int count = 0;
foreach (var item in e.Data)
count++;
string text = count + " items shown!";
}
或者您甚至可以这样做并避免循环:
private void AutoCompleteBox_Populated(object sender, PopulatedEventArgs e)
{
int count = ((ReadOnlyCollection<object>)e.Data).Count;
}
有没有办法获取当前显示在 WPF 工具包自动完成框下拉列表中的项目数?
处理 Populated
事件:
private void AutoCompleteBox_Populated(object sender, PopulatedEventArgs e)
{
int count = 0;
foreach (var item in e.Data)
count++;
string text = count + " items shown!";
}
或者您甚至可以这样做并避免循环:
private void AutoCompleteBox_Populated(object sender, PopulatedEventArgs e)
{
int count = ((ReadOnlyCollection<object>)e.Data).Count;
}