Hi,
I am wondering what changed to the ComboBoxAdv control. I am on release 20.1.0.60.
The Items in the ComboBoxAdv are not always showing. I cannot find a cause.
I am using
.NET 6, MVVM pattern, SimpleInject DI container.
In the Xaml View. I wrap a
ComboBoxAdv in a
SfTextInputLayout control.
<sf:SfTextInputLayout
x:Name="GenderEC"
Grid.Column="0"
Hint="{Binding GenderECHint}"
ToolTip="{Binding GenderECTT,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
HasError="{Binding GenderECHasError}"
d:Hint="Gender">
<sf:ComboBoxAdv
x:Name="GenderECCBB"
ItemsSource="{Binding ECGenderTypeItemsSource}"
SelectedItem="{Binding SelectedGenderECCBB, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
</sf:SfTextInputLayout>
On the ViewModel I define an
ObservableCollection<string>
public ObservableCollection<string> ECGenderTypeItemsSource { get; init; } = UIItemsSources.GenderTypeItemsSource;I have also tried to access the comboboxadv at runtime.
In xaml I have:
<sf:SfTextInputLayout
x:Name="Gender"
Grid.Column="0"
ToolTip="{Binding GenderTT}"
HasError="{Binding GenderHasError}"
Hint="{Binding GenderHint}"
d:Hint="Geslacht">
<sf:ComboBoxAdv
x:Name="GenderCBB"
SelectedItem="{Binding SelectedGenderCBB, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
DisplayMemberPath="Name">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Loaded">
<i:InvokeCommandAction
Command="{Binding GenderCBBLoaded}"
CommandParameter="{Binding ElementName=GenderCBB}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</sf:ComboBoxAdv>
</sf:SfTextInputLayout
and on the ViewModel I have
//GenderCBB
private ComboBoxAdv _genderCBB;
public ComboBoxAdv GenderCBB
{
get { return _genderCBB; }
set { _genderCBB = value; }
}
public DelegateCommand<object> GenderCBBLoaded { get; set; }
private void GenderCBB_Loaded()
{
GenderCBBLoaded = new DelegateCommand<object>((cbb) =>
{
GenderCBB = (ComboBoxAdv)cbb;
GenderCBB.ItemsSource = null;
GenderCBB.ItemsSource = GenderTypeItemsSource;
});
}
In this case the
GenderTypeItemsSource is an observablecollection of type https://github.com/ardalis/SmartEnum
I get access to the ComboBoxAdv object at runtime and even though I execute:
GenderCBB.ItemsSource = null;
GenderCBB.ItemsSource = GenderTypeItemsSource;
The items do not show. What I don't understand is that
GenderCBB.Items only shows 1 item, whereas GenderCBB.ItemsSource shows 4 (which is the correct number).
Should the SelectedItem be a nullable property in the ViewModel? I now have it defined as below:
private Gender? _selectedGender;
public Gender? SelectedGenderCBB
{
get { return _selectedGender; }
set
{
_selectedGender = value;
NotifyOfPropertyChange(() => SelectedGenderCBB);
}
}
Any help is appreciated,
Niels
Also note that when I change my xaml to a basic ComboBox instead of a ComboBoxAdv, I don't get these issues. The ItemsSource shows all the items all the time.
In addition - my master branch is still at
"20.1.0.56" and doesn't have issues
Hi NM van strien,
We have confirmed the reported scenario is a defect and logged a report for the reported scenario “ItemsSource not showing all the time”. We will include the fix in our upcoming Weekly NuGet release which is scheduled on 12th July 2022.
You can track the status of this defect using
the following feedback link:
All
items in that collection is not displayed all the time in WPF | Feedback Portal
(syncfusion.com)
If you have any more specification replication
procedures or a scenario to be tested, you can add it as a comment in the
portal.
Please let us know if you need any further assistance.
Regards,
Bagavathi Perumal A
Hello Bagavathi Perumal A,
I can only say that it seems to occur when or just after the SelectedItem or SelectedValue property of the ComboBoxAdv is set.
Niels van Strien
Hi NM van Strien,
Thanks for the update. As promised the fix will be included in our upcoming NuGet or 2022 Volume 2 release. We will let you know once it is released. We appreciate your patience until then.
Regards,
Bagavathi Perumal A
Hi NM van Strien,
We have fixed the reported issue "ItemsSource not showing all the time" from our end. We have included the fix for the reported issue in the 2022 Vol2 release which is available for download under the following link.
We thank you for your support and appreciate your patience in waiting for this update. Please get in touch with us if you require any further assistance.
Regards,
Bagavathi perumal A