WPF Listbox - Empty List Display Message

09-11-2015
<ListView Height="230"  Grid.Row="0"
          Name="lstKullaniciGrupListesiCoklu" SelectedValuePath="GrupKodu"
          SelectionMode="Single" Padding="5">
    <ListView.View>
        <GridView AllowsColumnReorder="False"
                  ColumnHeaderContainerStyle="{DynamicResource CustomColumnHeader}">
            <GridView.Columns>
                <GridViewColumn Header="Grup Adı" Width="370"
                                DisplayMemberBinding="{Binding Path=Adi}" />
            </GridView.Columns>
        </GridView>
    </ListView.View>

    <ListView.Style>

        <Style TargetType="ListView">

            <Style.Triggers>

                <Trigger Property="HasItems"
                         Value="False">

                    <Setter Property="Template">

                        <Setter.Value>

                            <ControlTemplate TargetType="ListView">

                                <Border Name="Border"
                                        BorderThickness="1"
                                        BorderBrush="#888"
                                        Background="{DynamicResource MainColor}">
                                    <StackPanel>
                                        <ListView>
                                            <ListView.View>
                                                <GridView AllowsColumnReorder="False"
                                                          ColumnHeaderContainerStyle="{DynamicResource CustomColumnHeader}">
                                                    <GridView.Columns>
                                                        <GridViewColumn
                                                            Header="Grup Adı"
                                                            Width="370"
                                                            DisplayMemberBinding="{Binding Path=Adi}" />
                                                    </GridView.Columns>
                                                </GridView>
                                            </ListView.View>
                                        </ListView>
                                        <TextBlock>
                                            <TextBlock.Inlines>
                                                <Run FontWeight="Normal" FontSize="14"
                                                     Text=" Grupları ekledikten/çıkardıktan sonra" />
                                                <Run FontWeight="Bold" FontSize="14"
                                                     Foreground="Red"
                                                     Text="Kaydet" />
                                                <LineBreak />
                                                <Run FontWeight="Normal" FontSize="14"
                                                     Text=" butonuna tıklayınız!" />
                                            </TextBlock.Inlines>

                                        </TextBlock>
                                    </StackPanel>

                                </Border>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>

                </Trigger>

            </Style.Triggers>
        </Style>

    </ListView.Style>

</ListView>

© 2019 All rights reserved. Codesenior.COM