Rich Application

Posts Tagged ‘Search Style

Search functionality will use Listview or Listbox to display the result. If there is no result found we will display message in different screen. In WPF with the use of Datatrigger we can change the Listview style in such a way it can display “Message” if there is no item exist or found .
Here the Datatrigger used in the Listview style.

 <style .Triggers>
                <datatrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Items.Count}"
                    Value="0">
                    <setter Property="Template" Value="{DynamicResource ListviewWithNoItem}"/>
                </datatrigger>
            </style>

If there is any item added , Listview will choose default Listview style else it wil show “ListviewWithNoItem” Style.

listviewstyle

  <controltemplate TargetType="{x:Type ListView}" x:Key="ListviewWithNoItem">
            <border SnapsToDevicePixels="true" x:Name="Bd" CornerRadius="3" Background="{TemplateBinding Background}" BorderBrush="#FFDDDDDD" 
                    BorderThickness="1">
                <grid>
                    <textblock HorizontalAlignment="Center" FontSize="15" Foreground="Gray" VerticalAlignment="Center" Text="No Items Found"/>
                </grid>

            </border>
    
        </controltemplate>

    
        <style x:Key="ListViewStyle" TargetType="{x:Type ListView}">
          
            </style><style .Triggers>
                <datatrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Items.Count}"
                    Value="0">
                    <setter Property="Template" Value="{DynamicResource ListviewWithNoItem}"/>
                </datatrigger>
            </style>
        

Find the Soure Here



  • monwsh.over-blog.com: I love what you guys tend to be up too. This sort of clever work and reporting! Keep up the amazing works guys I've included you guys to our blogrol
  • incense burner: This is very interesting, You are an excessively professional blogger. I have joined your rss feed and look forward to looking for more of your fanta
  • Online Low cost Hotels scheduling in The capital: We're a bunch of volunteers and opening a brand new scheme in our community. Your web site provided us with helpful info to work on. You've performed
August 2017
M T W T F S S
« Feb    
 123456
78910111213
14151617181920
21222324252627
28293031