Intersoft ClientUI 8 > ClientUI Controls > Control Library > Input Controls Overview > UXSearchBox > How-to: Customize No Result Visual Appearance in UXSearchBox |
This example shows how to customize no result visual appearance in UXSearchBox.
When the search in UXSearchBox does not return anything, it will show you no result text which you can set it using NoResultText property.
The following example shows how to set NoResultText property.
XAML |
Copy Code
|
---|---|
<Intersoft:UXSearchBox Name="HotelSearch" Intersoft:DockPanel.Dock="Right" Width="200" DisplayMemberPath="Hotel.Name" CornerRadius="15" NoResultText="No results..." AutoShowResultBox="True" SearchResult="{Binding SearchResult}" QueryText="{Binding QueryText, Mode=TwoWay}" NavigateUriMemberPath="NavigateUri" IsSearching="{Binding IsSearching, Mode=TwoWay}" /> |
You can also completely customize the no result appearance by using NoResultTemplate property, you can edit the template of the control and do the modification accordingly.
The following example shows how to change no result visual appearance in UXSearchBox using NoResultTemplate.
XAML |
Copy Code
|
---|---|
<Intersoft:UXPage.Resources> <DataTemplate x:Key="NoResultTemplate"> <StackPanel Orientation="Horizontal" HorizontalAlignment="Center"> <Image Source="/CustomizeItemAppearanceInUXSearchBox;component/Images/Cancel.png" Width="16" Height="16" /> <TextBlock Text="No Results..." VerticalAlignment="Center" Margin="5 0 0 0" /> </StackPanel> </DataTemplate> </Intersoft:UXPage.Resources> <Intersoft:UXSearchBox Name="HotelSearch" Intersoft:DockPanel.Dock="Right" Width="200" DisplayMemberPath="Hotel.Name" CornerRadius="15" SearchResult="{Binding SearchResult}" QueryText="{Binding QueryText, Mode=TwoWay}" NavigateUriMemberPath="NavigateUri" NoResultTemplate="{StaticResource NoResultTemplate}" AutoShowResultBox="True" IsSearching="{Binding IsSearching, Mode=TwoWay}"> |