ComboBoxAdv Filtring affects all instances of it

i have a comboboxadv in a UserControl that is called from ItemsControl

<StackPanel x:Name="expanderStack">
<ItemsControl ItemsSource="{Binding Meshimportoptions, Mode=OneWay}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<local:MeshImportOptions />
DataTemplate>
ItemsControl.ItemTemplate>
ItemsControl>
StackPanel>

i wanted to add filtring to combobox so i followed this article

in the user control xaml

<syncfusion:ComboBoxAdv
Grid.Column="1"
BorderBrush="{x:Null}"
FontFamily="Simplified Arabic Fixed"
FontSize="14"
FontWeight="DemiBold"
IsEditable="True"

ItemsSource="{Binding Materials, Mode=OneWay}"
SelectedItem="{Binding MTD, Mode=TwoWay, UpdateSourceTrigger=Default}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="KeyUp">
<local:FilterAction />
i:EventTrigger>
i:Interaction.Triggers>
syncfusion:ComboBoxAdv>


in the code behind

public class FilterAction : TargetedTriggerAction<ComboBoxAdv>
{
protected override void Invoke(object parameter)
{
CollectionView items = (CollectionView)CollectionViewSource.GetDefaultView(Target.ItemsSource);
items.Filter = ((o) =>
{
if (String.IsNullOrEmpty(Target.Text))
return true;
else
{
if ((o as string).Contains(Target.Text))
return true;
else
return false;
}
});
items.Refresh();
}
} // in the viewModels

//the coollection the item control is bound to

public List<MeshOptionsViewModel> Meshimportoptions { get; }
public class MeshOptionsViewModel : ObservableObject, IDisposable
{
private bool disposedValue;

public List<string> Materials { get; }

private string name;
private string mtd;

public string Name
{
get { return name; }
set { if (SetProperty(ref name, value)) { } }
}
public string MTD
{
get { return mtd; }
set { if (SetProperty(ref mtd, value)) { } }
}
}


the problem is when try to filter a combobox it will change the text on outher comboboxes and make them empty


in the attachment file there a gif that shows the behavior I get,

Also, there is this bug where the first input letter in the box will be deleted automatically as shown




Attachment: Comboboxbehavior_40234108.zip


1 Reply

BS Bhaskar Suresh Syncfusion Team January 10, 2024 08:17 AM UTC

Hi Ahmed,


We have tried to reproduce the reported issue based on the given information, but we are unable to reproduce the reported issue. Please refer to the sample and the video for your reference.


Could you please share the modified sample to replicate the issue?


Regards,

Bhaskar Suresh


Attachment: ComboBoxAdv_Filter_WPF_99b46b9e.zip

Loader.
Up arrow icon