11<?xml version =" 1.0" encoding =" utf-8" ?>
2- <ContentPage x : Class =" ArcGIS.Samples.StatsQueryGroupAndSort.StatsQueryGroupAndSort"
2+ <ContentPage x : Name =" StatsQueryGroupAndSortSample"
3+ x : Class =" ArcGIS.Samples.StatsQueryGroupAndSort.StatsQueryGroupAndSort"
34 xmlns =" http://schemas.microsoft.com/dotnet/2021/maui"
45 xmlns : x =" http://schemas.microsoft.com/winfx/2009/xaml" >
5- <ScrollView WidthRequest =" {OnIdiom Default=-1, Desktop=400}" >
6- <Grid HorizontalOptions =" FillAndExpand"
7- MinimumWidthRequest =" 400"
8- RowSpacing =" 3"
9- VerticalOptions =" Center" >
10- <Grid .ColumnDefinitions>
11- <ColumnDefinition Width =" auto" />
12- <ColumnDefinition Width =" auto" />
13- <ColumnDefinition Width =" auto" />
14- <ColumnDefinition Width =" auto" />
15- <ColumnDefinition Width =" *" />
16- </Grid .ColumnDefinitions>
17- <Grid .RowDefinitions>
18- <RowDefinition Height =" auto" />
19- <RowDefinition Height =" auto" />
20- <RowDefinition Height =" 150" />
21- <RowDefinition Height =" auto" />
22- <RowDefinition Height =" auto" />
23- <RowDefinition Height =" 150" />
24- <RowDefinition Height =" auto" />
25- <RowDefinition Height =" 150" />
26- <RowDefinition Height =" auto" />
27- <RowDefinition Height =" auto" />
28- </Grid .RowDefinitions>
29- <Label Grid.Row=" 0"
30- Grid.Column=" 1"
31- Grid.ColumnSpan=" 3"
32- Margin =" 25,0"
33- FontSize =" 18"
34- HorizontalOptions =" Center"
35- Text =" Statistics: US States"
36- VerticalOptions =" Center" />
37- <Picker x : Name =" FieldsComboBox"
38- Title =" Field"
39- Grid.Row=" 1"
40- Grid.Column=" 1"
41- Margin =" 25,0"
42- VerticalOptions =" CenterAndExpand"
43- WidthRequest =" 100" />
44- <Picker x : Name =" StatTypeComboBox"
45- Title =" Statistic"
46- Grid.Row=" 1"
47- Grid.Column=" 3"
48- Margin =" 5"
49- VerticalOptions =" CenterAndExpand"
50- WidthRequest =" 100" />
51- <Button x : Name =" AddStatisticButton"
52- Grid.Row=" 1"
53- Grid.Column=" 5"
54- Margin =" 5"
55- Padding =" 5"
56- Clicked =" AddStatisticClicked"
57- HeightRequest =" 30"
58- HorizontalOptions =" Start"
59- Text =" +"
60- VerticalOptions =" End"
61- WidthRequest =" 30" />
62- <ListView x : Name =" StatFieldsListBox"
63- Grid.Row=" 2"
64- Grid.ColumnSpan=" 5"
65- Margin =" 25,0"
66- BackgroundColor =" LightGray"
67- HorizontalOptions =" Fill" >
68- <ListView .ItemTemplate>
69- <DataTemplate >
70- <ViewCell >
71- <ViewCell .View>
72- <Grid >
73- <Grid .ColumnDefinitions>
74- <ColumnDefinition />
75- <ColumnDefinition />
76- </Grid .ColumnDefinitions>
77- <Label Text =" {Binding OnFieldName}" />
78- <Label Grid.Column=" 1" Text =" {Binding StatisticType}" />
79- </Grid >
80- </ViewCell .View>
81- </ViewCell >
82- </DataTemplate >
83- </ListView .ItemTemplate>
84- </ListView >
85- <Button x : Name =" RemoveStatField"
86- Grid.Row=" 3"
87- Grid.Column=" 0"
88- Grid.ColumnSpan=" 5"
89- Margin =" 25,0"
90- Clicked =" RemoveStatisticClicked"
91- HorizontalOptions =" Fill"
92- Text =" Remove"
93- VerticalOptions =" Start" />
94- <Label Grid.Row=" 4"
95- Grid.ColumnSpan=" 2"
96- Margin =" 25,0"
97- HorizontalOptions =" Start"
98- Text =" Group by"
99- VerticalOptions =" End" />
100- <ListView x : Name =" GroupFieldsListBox"
101- Grid.Row=" 5"
102- Grid.ColumnSpan=" 5"
103- Margin =" 25,0"
104- BackgroundColor =" LightGray" >
105- <ListView .ItemTemplate>
106- <DataTemplate >
107- <ViewCell >
108- <ViewCell .View>
109- <Grid >
110- <Grid .ColumnDefinitions>
111- <ColumnDefinition Width =" 50" />
112- <ColumnDefinition Width =" *" />
113- </Grid .ColumnDefinitions>
114- <Switch HorizontalOptions =" Start" Toggled =" GroupFieldCheckChanged" />
115- <Label Grid.Column=" 1"
116- HorizontalOptions =" Start"
117- Text =" {Binding Name}"
118- VerticalOptions =" Center" />
119- </Grid >
120- </ViewCell .View>
121- </ViewCell >
122- </DataTemplate >
123- </ListView .ItemTemplate>
124- </ListView >
125- <Label Grid.Row=" 6"
126- Grid.ColumnSpan=" 2"
127- Margin =" 25,0"
128- HorizontalOptions =" Start"
129- Text =" Order by"
130- VerticalOptions =" End" />
131- <ListView x : Name =" OrderByFieldsListBox"
132- Grid.Row=" 7"
133- Grid.ColumnSpan=" 5"
134- Margin =" 25,0"
135- BackgroundColor =" LightGray"
136- MinimumWidthRequest =" {OnIdiom Default=-1,
137- Desktop=400}" >
138- <ListView .ItemTemplate>
139- <DataTemplate >
140- <ViewCell >
141- <ViewCell .View>
142- <Grid >
143- <Grid .ColumnDefinitions>
144- <ColumnDefinition Width =" 50" />
145- <ColumnDefinition Width =" 2*" />
146- <ColumnDefinition Width =" 2*" />
147- </Grid .ColumnDefinitions>
148- <Switch IsToggled =" {Binding OrderWith}" />
149- <Label Grid.Column=" 1"
150- Text =" {Binding OrderInfo.FieldName}"
151- VerticalOptions =" Center" />
152- <Label Grid.Column=" 2"
153- Text =" {Binding OrderInfo.SortOrder}"
154- VerticalOptions =" Center" />
155- </Grid >
156- </ViewCell .View>
157- </ViewCell >
158- </DataTemplate >
159- </ListView .ItemTemplate>
160- </ListView >
161- <Button x : Name =" SortOrderButton"
162- Grid.Row=" 8"
163- Grid.Column=" 0"
164- Grid.ColumnSpan=" 5"
165- Margin =" 25,0"
166- Clicked =" ChangeFieldSortOrder"
167- HorizontalOptions =" Fill"
168- Text =" Change sort order"
169- VerticalOptions =" Start" />
170- <Button x : Name =" GetStatisticsButton"
171- Grid.Row=" 9"
172- Grid.Column=" 0"
173- Grid.ColumnSpan=" 5"
174- Margin =" 25,0,25,5"
175- Clicked =" OnExecuteStatisticsQueryClicked"
176- HorizontalOptions =" Fill"
177- Text =" Get Statistics"
178- VerticalOptions =" Fill" />
179- <Grid x : Name =" ResultsGrid"
180- Grid.Row=" 1"
181- Grid.RowSpan=" 9"
182- Grid.Column=" 0"
183- Grid.ColumnSpan=" 5"
184- BackgroundColor =" LightGray"
185- IsVisible =" False" >
186- <Grid .RowDefinitions>
187- <RowDefinition />
188- <RowDefinition Height =" 50" />
189- </Grid .RowDefinitions>
190- <ListView x : Name =" StatResultsList" IsGroupingEnabled =" true" >
191- <ListView .GroupHeaderTemplate>
6+
7+ <ContentPage .Resources>
8+ <ResourceDictionary >
9+ <Style x : Key =" CollectionViewStyle" TargetType =" CollectionView" >
10+ <Setter Property =" BackgroundColor" Value =" {AppThemeBinding Dark=Black, Light=White}" />
11+ <Setter Property =" MinimumHeightRequest" Value =" 50" />
12+ <Setter Property =" MaximumHeightRequest" Value =" 200" />
13+ </Style >
14+ </ResourceDictionary >
15+ </ContentPage .Resources>
16+
17+ <ScrollView Margin =" 5" >
18+ <StackLayout BindingContext =" {x:Reference StatsQueryGroupAndSortSample}" >
19+ <StackLayout x : Name =" QueryConfigurationLayout"
20+ Padding =" 5"
21+ HorizontalOptions =" Center"
22+ Spacing =" 10" >
23+ <Label FontAttributes =" Bold"
24+ FontSize =" Large"
25+ HorizontalOptions =" Center"
26+ Text =" Statistics: US States" />
27+ <Label FontAttributes =" Bold" Text =" Add statistics" />
28+ <Grid Margin =" 10"
29+ ColumnDefinitions =" *,*,auto"
30+ ColumnSpacing =" 10" >
31+ <Picker x : Name =" FieldsComboBox" Title =" Field" />
32+ <Picker x : Name =" StatTypeComboBox"
33+ Title =" Statistic"
34+ Grid.Column=" 1" />
35+ <Button x : Name =" AddStatisticButton"
36+ Grid.Column=" 2"
37+ Clicked =" AddStatistic_Clicked"
38+ Text =" +"
39+ VerticalOptions =" End" />
40+ </Grid >
41+ <CollectionView x : Name =" StatFieldsListBox"
42+ SelectionMode =" Single"
43+ Style =" {DynamicResource CollectionViewStyle}" >
44+ <CollectionView .ItemTemplate>
19245 <DataTemplate >
193- <TextCell Height =" 30" Text =" {Binding GroupName}" />
46+ <Grid ColumnDefinitions =" *,*" >
47+ <Label Text =" {Binding OnFieldName}" />
48+ <Label Grid.Column=" 1" Text =" {Binding StatisticType}" />
49+ </Grid >
19450 </DataTemplate >
195- </ListView .GroupHeaderTemplate>
196- <ListView .ItemTemplate>
51+ </CollectionView .ItemTemplate>
52+ </CollectionView >
53+ <Button x : Name =" RemoveStatField"
54+ Clicked =" RemoveStatistic_Clicked"
55+ Text =" Remove statistic" />
56+ <Label FontAttributes =" Bold" Text =" Group by" />
57+ <CollectionView x : Name =" GroupFieldsListBox" Style =" {DynamicResource CollectionViewStyle}" >
58+ <CollectionView .ItemTemplate>
19759 <DataTemplate >
198- <TextCell Detail =" {Binding StatValue}" Text =" {Binding FieldName}" />
60+ <Grid ColumnDefinitions =" 50,*" >
61+ <Switch HorizontalOptions =" Start" Toggled =" GroupField_Toggled" />
62+ <Label Grid.Column=" 1"
63+ HorizontalOptions =" Start"
64+ Text =" {Binding Name}"
65+ VerticalOptions =" Center" />
66+ </Grid >
19967 </DataTemplate >
200- </ListView .ItemTemplate>
201- </ListView >
202- <Button Grid.Row=" 1"
203- Margin =" 5"
204- Clicked =" HideResults"
205- Text =" Dismiss" />
206- </Grid >
207- </Grid >
68+ </CollectionView .ItemTemplate>
69+ </CollectionView >
70+ <Label FontAttributes =" Bold" Text =" Order by" />
71+ <CollectionView x : Name =" OrderByFieldsListBox" Style =" {DynamicResource CollectionViewStyle}" >
72+ <CollectionView .ItemTemplate>
73+ <DataTemplate >
74+ <Grid ColumnDefinitions =" 50, 2*, 2*" >
75+ <Switch IsToggled =" {Binding OrderWith}" />
76+ <Label Grid.Column=" 1"
77+ Text =" {Binding OrderInfo.FieldName}"
78+ VerticalOptions =" Center" />
79+ <Label Grid.Column=" 2"
80+ Text =" {Binding OrderInfo.SortOrder}"
81+ VerticalOptions =" Center" />
82+ </Grid >
83+ </DataTemplate >
84+ </CollectionView .ItemTemplate>
85+ </CollectionView >
86+ <Button x : Name =" SortOrderButton"
87+ Clicked =" SortOrderButton_Clicked"
88+ Text =" Change sort order" />
89+ <Button x : Name =" GetStatisticsButton"
90+ Clicked =" GetStatisticsButton_Clicked"
91+ Text =" Get statistics" />
92+ </StackLayout >
93+
94+ <StackLayout x : Name =" ResultsLayout"
95+ IsVisible =" False"
96+ Spacing =" 5" >
97+ <Label FontAttributes =" Bold"
98+ FontSize =" Large"
99+ HorizontalOptions =" Center"
100+ Text =" Query results" />
101+ <CollectionView x : Name =" StatResultsList"
102+ IsGrouped =" True"
103+ MaximumHeightRequest =" {OnIdiom Default=800,
104+ Phone=600}" >
105+ <CollectionView .GroupHeaderTemplate>
106+ <DataTemplate >
107+ <Label FontAttributes =" Bold"
108+ FontSize =" Medium"
109+ Text =" {Binding GroupName}" />
110+ </DataTemplate >
111+ </CollectionView .GroupHeaderTemplate>
112+ <CollectionView .ItemTemplate>
113+ <DataTemplate >
114+ <HorizontalStackLayout Spacing =" 5" >
115+ <Label FontAttributes =" Bold" Text =" {Binding FieldName}" />
116+ <Label Text =" {Binding StatValue}" />
117+ </HorizontalStackLayout >
118+ </DataTemplate >
119+ </CollectionView .ItemTemplate>
120+ </CollectionView >
121+ <Button Clicked =" DismissResults_Clicked" Text =" Dismiss" />
122+ </StackLayout >
123+ </StackLayout >
208124 </ScrollView >
125+
209126</ContentPage >
0 commit comments