How to display leading and trailing view in WinUI AutoComplete Control?
This article explains how to display LeadingView and TrailingView in the WinUI AutoComplete control.
The LeadingView appears before the AutoComplete selection area, while the TrailingView appears after it. You can display any content—such as an icon, image, button, or other control—in these view areas to enhance the user interface and functionality.
Leading View
The following code shows how to include the LeadingView in AutoComplete.
XAML
<editors:SfAutoComplete Header="AutoComplete with Leading View"
PlaceholderText="Search a country">
<editors:SfAutoComplete.LeadingView>
<Viewbox Height="16"
Width="16"
Margin="4,0,0,0">
<SymbolIcon Symbol="Find" />
</Viewbox>
</editors:SfAutoComplete.LeadingView>
</editors:SfAutoComplete>
Trailing View
The following code shows how to include the TrailingView in AutoComplete.
XAML
<editors:SfAutoComplete Header="AutoComplete with Trailing View"
PlaceholderText="Search a country">
<editors:SfAutoComplete.TrailingView>
<Button Style="{ThemeResource AlternateCloseButtonStyle}"
Height="30"
AllowFocusOnInteraction="False">
<Viewbox Height="16"
Width="16">
<FontIcon Glyph="" />
</Viewbox>
</Button>
</editors:SfAutoComplete.TrailingView>
</editors:SfAutoComplete>
Leading and Trailing View
The following code shows how to include both the LeadingView and TrailingView in AutoComplete.
XAML
<editors:SfAutoComplete Header="AutoComplete with Leading and Trailing View"
PlaceholderText="Search a country">
<editors:SfAutoComplete.LeadingView>
<editors:SfComboBox Margin="0,4,0,4">
<editors:SfComboBoxItem Content="Asia" />
<editors:SfComboBoxItem Content="Africa" />
<editors:SfComboBoxItem Content="North America"/>
<editors:SfComboBoxItem Content="South America" />
<editors:SfComboBoxItem Content="Europe" />
<editors:SfComboBoxItem Content="All Countries"
IsSelected="True"/>
</editors:SfComboBox>
</editors:SfAutoComplete.LeadingView>
<editors:SfAutoComplete.TrailingView>
<Viewbox Height="16"
Width="16"
Margin="0,0,8,0">
<SymbolIcon Symbol="Find" />
</Viewbox>
</editors:SfAutoComplete.TrailingView>
</editors:SfAutoComplete>
Conclusion
I hope you enjoyed learning about How to Display Leading and Trailing View in WinUI AutoComplete Control.
You can refer to our
WinUI AutoComplete feature tour page to know about its other ground breaking 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 forums, Direct-Trac, or feedback portal. We are always happy to assist you!