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