AutoCompleteBox 필터링에 문제가 있습니다.SL4 AutoCompleteBox 반복 필터 결과 문제
이전 필터를 수정 한 것 같습니다.
예를 들어 'A'를 입력하면 1 개의 항목이 반환됩니다. 'A'를 삭제하고 'Z'를 입력하면 1 개 항목을 반환합니다.
'A'필터와 'Z'에서 결과를 반환하고, 'Z'를 삭제하고 'S'를 입력하여 2 개의 항목을 가져오고 이제는 3 개의 필터 모두에서 결과를 표시하는 것이 문제입니다.
내가 잘못 했나요?
stockTypes.Add(new StockTypeDTO() { Description = "Steel Coil", StockCode = "SC" });
stockTypes.Add(new StockTypeDTO() { Description = "Palletised Steel Coil", StockCode = "PS" });
stockTypes.Add(new StockTypeDTO() { Description = "ZZZZZ", StockCode = "ZZ" });
<input:AutoCompleteBox x:Name="testauto" FilterMode="Custom">
<input:AutoCompleteBox.ItemTemplate>
<DataTemplate>
<StackPanel>
<ContentPresenter Content="{Binding Description}" />
</StackPanel>
</DataTemplate>
</input:AutoCompleteBox.ItemTemplate>
</input:AutoCompleteBox>
testauto.ItemsSource = this.StockTypes;
testauto.ItemFilter = (search, item) =>
{
StockTypeDTO stockType = item as StockTypeDTO;
if (stockType != null)
{
string filter = search.ToUpper(CultureInfo.InvariantCulture);
return (stockType.StockCode.ToUpper(CultureInfo.InvariantCulture).Contains(filter)
|| stockType.Description.ToUpper(CultureInfo.InvariantCulture).Contains(filter));
}
return false;
};
감사합니다. 저를 위해 깨뜨린 것은 전세계적인 주제였습니다. –