Hallo,
when setting the selected index from a viewmodel, the value in the combobox is not changing. Meaning, when for example I set the Index to the value of 1, the item is not changing in the combobox, it just stays as it is.
viewmodel:
if (value.GetType().GetProperty("Type").GetValue(value) != null)
{
BikeType = (value.GetType().GetProperty("Type").GetValue(value, null)).ToString();
SelectedIndexBikeParameter = GetBikeParameter.Where<BikeParameter>(x => x.AsBike == BikeType).Select<BikeParameter, int>(x => GetBikeParameter.IndexOf(x)).Single<int>();
}
xaml:
<combobox:SfComboBox
Margin="10,10,10,10"
x:DataType="{x:Null}"
ItemsSource="{Binding GetBikeParameter}"
DisplayMemberPath="BikeType"
HeightRequest="50"
IsEditable="False"
SelectedIndex="{Binding SelectedIndexBikeParameter, Mode=TwoWay}"
SelectedItem="{Binding SelectedItemBikeParameter, Mode=TwoWay}"
TextColor="Green">
<combobox:SfComboBox.ItemTemplate>
<DataTemplate>
<StackLayout Orientation="Horizontal">
<Label
FontAttributes="Bold"
FontSize="Small"
Text="{Binding BikeType}"
TextColor="Black" />
</StackLayout>
</DataTemplate>
</combobox:SfComboBox.ItemTemplate>
</combobox:SfComboBox>
Thanks,
Markus
Hi Markus,
We have checked the reported issue based on the provided information but we were unable to reproduce the reported issue "When setting the selected index from a view model, the value in the combobox is not changing" at our end. We have attached the tested sample and its demonstration video for your reference. Kindly review the attached sample and its video and apply any required modifications to reproduce the problem in the sample. Afterward, kindly forward the sample to us or share an issue replication sample with replication steps. This will enable us to closely predict your issue and offer a more accurate solution.
Regards,
Brundha V
Hallo Brundha,
thanks for your answer. Selecting an item is working and the index is changing. What is not working in my case, when I set the index in the viewmodel, the combobox is not changing to the item with the new set index
I found out, when the index is set to -1, than it is not working. If I have an item selected, it is working, when I change the index. I need to select -1 to reset and start the combobox with no selection
Thanks,
Markus
Hi Markus,
We are able to reproduce the reported issue at our end. We have logged a bug report for this. You can track the status of the bug through the feedback link provided below.
We will share a patch for the reported issue on November 15, 2023. We appreciate your patience until then.
Note: The provided feedback link is private, and you need to log in to view this feedback.
If you have any more specifications or a scenario to be tested, you can add them as a comment in the portal.
Disclaimer: “Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization.”
Regards,
Brundha V
Hi Markus,
We have fixed the reported issue "SelectedIndex is not properly updated after setting the SelectedIndex as -1 in SfComboBox". At present, a custom patch has been created for version 23.1.44. We have attached the NuGet file for your convenience.
Please note that we have created this patch for version 23.1.44 specifically to resolve the issue reported in this ticket. If you have received other patches for the same version for other products, please apply all patches in the order received.
Note: Please refer to the below link to apply the custom patch.
https://www.syncfusion.com/kb/6987/how-to-clear-nuget-cache
We will include the fix in our upcoming weekly release on November 21, 2023. We appreciate your patience until then.
Disclaimer: The inclusion of this solution in the weekly release may change due to other factors, including but not limited to QA checks and work reprioritization.
Regards,
Brundha V
Hi Brundha ,
thank you :) This is great news
Thanks,
Markus
Hi Markus,
Thanks for the update.
We regret to inform that, we don't have a weekly NuGet release on November 21, 2023, due to the Volume 3 SP1 release. The fix will be included in our upcoming weekly NuGet release on November 28, 2023. We will inform you once the weekly NuGet released, and appreciate your patience until then.
Regards,
Brundha V
Hi Markus,
Thanks for your patience.
We have included the fix for the reported issue "SelectedIndex is not properly updated after setting the SelectedIndex as -1 in SfComboBox" in our latest weekly NuGet release v23.2.5 which is available for download ( https://www.nuget.org/ ). We thank you for your support and appreciate your patience in waiting for this update. Please get in touch with us if you would require any further assistance.
Regards,
Brundha V