Using the ListPlaceholder Control
Using the ListTarget property of the ListPlaceholder control, point to the ListViewBase control you want it to monitor. Do this using the ElementName binding. By default, whenever that monitored ListViewBase's ItemsSource is null, the ListPlaceholder will show its LoadingPlaceholderContent. When ListViewBase's ItemsSource is not null but is empty, it will show its EmptyPlaceholderContent.

    <q:ListPlaceholder ListTarget="{Binding ElementName=MyList}"
                       LoadingPlaceholderContent="Looking for stuff, hang tight..."
                       EmptyPlaceholderContent="Nothing to see here... move along." />
    <ListView x:Name="MyList" />

To manually switch it between LoadingPlaceholderContent and EmptyPlaceholderContent, use the PlaceholderMode and set it to either ListPlaceholderMode.Loading or ListPlaceholderMode.Empty. The placeholder content will still only show when there is no items visible in the list though.

Default Style
<DataTemplate x:Key="ListPlaceholderContentTemplate">
    <TextBlock Text="{Binding}"
               Style="{ThemeResource ListViewEmptyStaticTextBlockStyle}" />
<Style TargetType="local:ListPlaceholder">
    <Setter Property="LoadingPlaceholderContent"
            Value="Loading..." />
    <Setter Property="EmptyPlaceholderContent"
            Value="Nothing to show." />
    <Setter Property="LoadingPlaceholderTemplate"
            Value="{StaticResource ListPlaceholderContentTemplate}" />
    <Setter Property="EmptyPlaceholderTemplate"
            Value="{StaticResource ListPlaceholderContentTemplate}" />
    <Setter Property="Template">
            <ControlTemplate TargetType="local:ListPlaceholder">
                <ContentPresenter Content="{TemplateBinding PlaceholderContent}"
                                  ContentTemplate="{TemplateBinding PlaceholderTemplate}"
                                  Visibility="{TemplateBinding PlaceholderVisibility}" />

Last edited Aug 27, 2014 at 7:58 PM by qdev, version 2