How to get the selected value in the WinUI SfAutoComplete?
In this article, we explore the SelectionValuePath property of the WinUI SfAutoComplete control. This property allows you to specify which value should be used as the SelectedValue from the control’s SelectedItem. The SelectionValuePath defines the path to the property within the selected item that will be assigned to SelectedValue. By default, both SelectedValue and SelectionValuePath are set to null.
<editors:SfAutoComplete
SelectedValuePath="ID"
x:Name="autoComplete"
TextMemberPath="Name"
DisplayMemberPath="Name"
ItemsSource="{Binding SocialMedias}"
SelectionChanged="OnSelectionChanged"/>
<TextBlock Text="SelectedValue :"/>
<TextBlock x:Name="selectedValue"/>
private void OnSelectionChanged(object sender, AutoCompleteSelectionChangedEventArgs e)
{
selectedValue.Text = autoComplete.SelectedValue.ToString();
}
Conclusion
I hope you enjoyed learning about how to get the selected value in the WinUI SfAutoComplete.
You can refer to our WinUI Autocomplete feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications.
For current customers, you can check out our components from the Licence and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forum, Support portal, or feedback portal. We are always happy to assist you!