33 xmlns : x =" http://schemas.microsoft.com/winfx/2006/xaml"
44 xmlns : d =" http://schemas.microsoft.com/expression/blend/2008"
55 xmlns : mc =" http://schemas.openxmlformats.org/markup-compatibility/2006"
6+ xmlns : local =" clr-namespace:SimpleDataGrid.Example"
7+ xmlns : controls =" clr-namespace:SimpleDataGrid.Controls;assembly=SimpleDataGrid"
8+ xmlns : converters =" clr-namespace:SimpleDataGrid.Example.Converters"
69 mc : Ignorable =" d"
710 Title =" AdvancedExamplesWindow" Height =" 450" Width =" 800" >
11+ <Window .Resources>
12+ <converters : ItemCountConverter x : Key =" ItemCountConverter" />
13+ <BooleanToVisibilityConverter x : Key =" BooleanToVisibilityConverter" />
14+ </Window .Resources>
15+ <Window .DataContext>
16+ <local : AdvancedExamplesViewModel />
17+ </Window .DataContext>
818 <Grid >
9-
19+ <Grid .RowDefinitions>
20+ <RowDefinition Height =" Auto" />
21+ <RowDefinition Height =" *" />
22+ <RowDefinition Height =" Auto" />
23+ </Grid .RowDefinitions>
24+
25+ <StackPanel Grid.Row=" 0" Orientation =" Vertical" Margin =" 5" >
26+ <StackPanel Orientation =" Horizontal" >
27+ <TextBox x : Name =" SearchTextBox" Width =" 200" Margin =" 5" TextChanged =" SearchTextBox_TextChanged" />
28+ <CheckBox x : Name =" WildcardCheckBox" Content =" Use Wildcards" VerticalAlignment =" Center" Margin =" 5" />
29+ <ProgressBar IsIndeterminate =" True" Width =" 20" Height =" 20" Margin =" 5" Visibility =" {Binding People.IsSearching, Converter={StaticResource BooleanToVisibilityConverter}}" />
30+ </StackPanel >
31+ <StackPanel Orientation =" Horizontal" Margin =" 5,0,0,0" >
32+ <TextBlock Text =" Search In:" VerticalAlignment =" Center" Margin =" 0,0,5,0" />
33+ <CheckBox Content =" Name" IsChecked =" {Binding SearchByName}" Checked =" SearchOption_Changed" Unchecked =" SearchOption_Changed" Margin =" 0,0,5,0" />
34+ <CheckBox Content =" Email" IsChecked =" {Binding SearchByEmail}" Checked =" SearchOption_Changed" Unchecked =" SearchOption_Changed" Margin =" 0,0,5,0" />
35+ <CheckBox Content =" Department" IsChecked =" {Binding SearchByDepartment}" Checked =" SearchOption_Changed" Unchecked =" SearchOption_Changed" Margin =" 0,0,5,0" />
36+ </StackPanel >
37+ <StackPanel Orientation =" Horizontal" >
38+ <TextBox x : Name =" MinAgeTextBox" Width =" 50" Margin =" 5" />
39+ <Button Content =" Filter by Min Age" Click =" FilterButton_Click" Margin =" 5" />
40+ <TextBox x : Name =" MaxAgeTextBox" Width =" 50" Margin =" 5" />
41+ <Button Content =" Filter by Max Age" Click =" MaxAgeFilterButton_Click" Margin =" 5" />
42+ <TextBox x : Name =" NamePrefixTextBox" Width =" 100" Margin =" 5" />
43+ <Button Content =" Filter by Name Prefix" Click =" NamePrefixFilterButton_Click" Margin =" 5" />
44+ <Button Content =" Clear Filters" Click =" ClearFilterButton_Click" Margin =" 5" />
45+ </StackPanel >
46+ <ItemsControl ItemsSource =" {Binding People.ActiveFilters}" >
47+ <ItemsControl .ItemsPanel>
48+ <ItemsPanelTemplate >
49+ <StackPanel Orientation =" Horizontal" />
50+ </ItemsPanelTemplate >
51+ </ItemsControl .ItemsPanel>
52+ <ItemsControl .ItemTemplate>
53+ <DataTemplate >
54+ <StackPanel Orientation =" Horizontal" >
55+ <TextBlock Text =" {Binding}" VerticalAlignment =" Center" Margin =" 5,0" />
56+ <Button Content =" Remove" Click =" RemoveFilterButton_Click" CommandParameter =" {Binding}" Margin =" 5,0" />
57+ </StackPanel >
58+ </DataTemplate >
59+ </ItemsControl .ItemTemplate>
60+ </ItemsControl >
61+ </StackPanel >
62+
63+ <controls : PagedDataGrid x : Name =" PagedDataGrid" Grid.Row=" 1" PagedSource =" {Binding People}" AutoGenerateColumns =" True" />
64+
65+ <Grid Grid.Row=" 1" Background =" #AAFFFFFF" Visibility =" {Binding People.IsEmpty, Converter={StaticResource BooleanToVisibilityConverter}}" >
66+ <StackPanel VerticalAlignment =" Center" HorizontalAlignment =" Center" >
67+ <TextBlock Text =" No items found." FontSize =" 24" FontWeight =" Bold" Margin =" 0,0,0,10" />
68+ <TextBlock Text =" Try clearing your filters or search terms." FontSize =" 14" TextAlignment =" Center" />
69+ </StackPanel >
70+ </Grid >
71+
72+ <StackPanel Grid.Row=" 2" Orientation =" Horizontal" HorizontalAlignment =" Center" >
73+ <Button Content =" First" Click =" FirstButton_Click" Margin =" 5" IsEnabled =" {Binding People.HasPrevious}" />
74+ <Button Content =" Previous" Click =" PreviousButton_Click" Margin =" 5" IsEnabled =" {Binding People.HasPrevious}" />
75+ <TextBlock VerticalAlignment =" Center" Margin =" 5" >
76+ <TextBlock .Text>
77+ <MultiBinding StringFormat =" Page {0} of {1}" >
78+ <Binding Path =" People.CurrentPage" />
79+ <Binding Path =" People.TotalPages" />
80+ </MultiBinding >
81+ </TextBlock .Text>
82+ </TextBlock >
83+ <Button Content =" Next" Click =" NextButton_Click" Margin =" 5" IsEnabled =" {Binding People.HasNext}" />
84+ <Button Content =" Last" Click =" LastButton_Click" Margin =" 5" IsEnabled =" {Binding People.HasNext}" />
85+ <TextBlock Text =" Go to page:" VerticalAlignment =" Center" Margin =" 5,0,0,0" />
86+ <TextBox x : Name =" PageTextBox" Width =" 30" Margin =" 5,0,0,0" />
87+ <Button Content =" Go" Click =" GoToPageButton_Click" Margin =" 5,0,0,0" />
88+ <ComboBox Margin =" 10,0,0,0" ItemsSource =" {Binding PageSizes}" SelectedItem =" {Binding People.PageSize}" />
89+ <TextBlock VerticalAlignment =" Center" Margin =" 10,0,0,0" >
90+ <TextBlock .Text>
91+ <MultiBinding Converter =" {StaticResource ItemCountConverter}" >
92+ <Binding Path =" People.CurrentPageItems.Count" />
93+ <Binding Path =" People.CurrentPage" />
94+ <Binding Path =" People.TotalItems" />
95+ <Binding Path =" People.PageSize" />
96+ </MultiBinding >
97+ </TextBlock .Text>
98+ </TextBlock >
99+ </StackPanel >
10100 </Grid >
11101</Window >
0 commit comments