File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed
Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change 1111 Title =" MainWindow" Height =" 450" Width =" 800" >
1212 <Window .Resources>
1313 <converters : ItemCountConverter x : Key =" ItemCountConverter" />
14+ <BooleanToVisibilityConverter x : Key =" BooleanToVisibilityConverter" />
1415 </Window .Resources>
1516 <Window .DataContext>
1617 <local : MainViewModel />
5657
5758 <controls : PagedDataGrid x : Name =" PagedDataGrid" Grid.Row=" 1" PagedSource =" {Binding People}" AutoGenerateColumns =" True" />
5859
60+ <Grid Grid.Row=" 1" Background =" #AAFFFFFF" Visibility =" {Binding People.IsEmpty, Converter={StaticResource BooleanToVisibilityConverter}}" >
61+ <StackPanel VerticalAlignment =" Center" HorizontalAlignment =" Center" >
62+ <TextBlock Text =" No items found." FontSize =" 24" FontWeight =" Bold" Margin =" 0,0,0,10" />
63+ <TextBlock Text =" Try clearing your filters or search terms." FontSize =" 14" TextAlignment =" Center" />
64+ </StackPanel >
65+ </Grid >
66+
5967 <StackPanel Grid.Row=" 2" Orientation =" Horizontal" HorizontalAlignment =" Center" >
6068 <Button Content =" First" Click =" FirstButton_Click" Margin =" 5" IsEnabled =" {Binding People.HasPrevious}" />
6169 <Button Content =" Previous" Click =" PreviousButton_Click" Margin =" 5" IsEnabled =" {Binding People.HasPrevious}" />
Original file line number Diff line number Diff line change @@ -248,6 +248,21 @@ private static string WildcardToRegex(string pattern)
248248 /// </summary>
249249 public int TotalItems => _filtered . Count ;
250250
251+ /// <summary>
252+ /// Gets a value indicating whether the filtered collection is empty.
253+ /// </summary>
254+ public bool IsEmpty => _filtered . Count == 0 ;
255+
256+ /// <summary>
257+ /// Gets a value indicating whether the filtered collection has any items.
258+ /// </summary>
259+ public bool HasItems => _filtered . Count > 0 ;
260+
261+ /// <summary>
262+ /// Gets a value indicating whether the original source collection is empty.
263+ /// </summary>
264+ public bool IsSourceEmpty => _source . Count == 0 ;
265+
251266 /// <summary>
252267 /// Gets a value indicating whether there is a next page.
253268 /// </summary>
@@ -347,6 +362,9 @@ private void RaiseAllChanged()
347362 OnPropertyChanged ( nameof ( TotalPages ) ) ;
348363 OnPropertyChanged ( nameof ( HasNext ) ) ;
349364 OnPropertyChanged ( nameof ( HasPrevious ) ) ;
365+ OnPropertyChanged ( nameof ( IsEmpty ) ) ;
366+ OnPropertyChanged ( nameof ( HasItems ) ) ;
367+ OnPropertyChanged ( nameof ( IsSourceEmpty ) ) ;
350368 }
351369
352370 /// <summary>
You can’t perform that action at this time.
0 commit comments