private void WTNR_GRID_jbzl_AutoCompleteBox_Loaded(object sender, System.Windows.RoutedEventArgs e)
{
List<JBJS> cs = new List<JBJS>();
cs.Add(new JBJS { Name = "广州", ShortName = "GZ" });
cs.Add(new JBJS { Name = "南京", ShortName = "NJ" });
cs.Add(new JBJS { Name = "上海", ShortName = "SH" });
cs.Add(new JBJS { Name = "北京", ShortName = "BJ" });
cs.Add(new JBJS { Name = "扬州", ShortName = "YZ" });
cs.Add(new JBJS { Name = "杭州", ShortName = "HZ" });
WTNR_GRID_jbzl_AutoCompleteBox.ItemFilter = (search, item) =>
{
JBJS city = item as JBJS;
if (city != null)
{
string filter = search.ToLower();
return city.Name.Contains(filter) |city.ShortName.ToLower().Contains(filter);
}
return false;
};
WTNR_GRID_jbzl_AutoCompleteBox.ItemsSource = cs;
}