引入自定义控件
<controls:Intellibox Style="{StaticResource ListSearch-SearchIntellibox}"
Width="95" Margin="0,3" MaxResults="200"
DataProvider="{x:Static intelliBoxProvider:DrawBackDepProvider.Provider}"
SelectedItem="{Binding SelectedDepartmentItem,UpdateSourceTrigger=PropertyChanged}"
ExplicitlyIncludeColumns="True" DisplayedValueBinding="{Binding Name}"
IsSingleMode="True" TextSeparator="" UseSelectedItem="True">
<controls:Intellibox.Columns>
<controls:IntelliboxColumn DisplayMemberBinding="{Binding DepCode}" Header="部门代码"/>
<controls:IntelliboxColumn DisplayMemberBinding="{Binding Name}" Header="部门名称"/>
</controls:Intellibox.Columns>
</controls:Intellibox>
private void InitData()
{
Task.Factory.StartNew(() =>
{
DrawBackDepProvider.Provider.Init();
});
}
控件引入自定义控件,cs初始化控件的查询,输入文本内容进行过滤,也可以改成实时查询的
_supplierSource.Where(p =>
p.Name.ToUpper().Contains(searchTerm.ToUpper()) || (p.DepCode ?? "").ToUpper().Contains(searchTerm.ToUpper())).Take(maxResults).ToList();