|
5 | 5 | xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
6 | 6 | xmlns:Core="using:Microsoft.Xaml.Interactions.Core" |
7 | 7 | xmlns:controls="using:CommunityToolkit.WinUI.UI.Controls" |
| 8 | + xmlns:converters="using:CommunityToolkit.WinUI.Converters" |
8 | 9 | xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
9 | 10 | xmlns:graph="using:Microsoft.Graph.Models" |
10 | 11 | xmlns:i="using:Microsoft.Xaml.Interactivity" |
11 | 12 | xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
12 | | - xmlns:sys="using:System" Loaded="Page_Loaded" |
13 | 13 | xmlns:vm="using:MsGraphSamples.WinUI.ViewModels" |
14 | 14 | d:DataContext="{d:DesignInstance Type=vm:MainViewModel}" |
| 15 | + Loaded="Page_Loaded" |
15 | 16 | mc:Ignorable="d"> |
16 | 17 |
|
17 | | - <Grid Margin="0,24,0,0"> |
| 18 | + <Page.Resources> |
| 19 | + <converters:BoolNegationConverter x:Key="BoolNegationConverter" /> |
| 20 | + <converters:StringFormatConverter x:Key="StringFormatConverter" /> |
| 21 | + </Page.Resources> |
| 22 | + |
| 23 | + <Grid Margin="0,28,0,0"> |
18 | 24 | <Grid.RowDefinitions> |
19 | 25 | <RowDefinition Height="Auto" /> |
20 | 26 | <RowDefinition Height="*" /> |
|
84 | 90 | Margin="6,0" |
85 | 91 | VerticalAlignment="Bottom"> |
86 | 92 |
|
87 | | - <TextBlock |
88 | | - Margin="0,3" |
89 | | - FontWeight="Bold" |
90 | | - Text="{x:Bind sys:String.Format(x:Null, 'Entities: {0:N0} / {1:N0}', ViewModel.DirectoryObjects.Count, ViewModel.LastCount), Mode=OneWay}" /> |
| 93 | + <TextBlock Margin="0,3" FontWeight="Bold"> |
| 94 | + <Run Text="Entities: " /> |
| 95 | + <Run Text="{x:Bind ViewModel.DirectoryObjects.Count, Mode=OneWay}" /> |
| 96 | + <Run Text=" / " /> |
| 97 | + <Run Text="{x:Bind ViewModel.LastCount, Mode=OneWay}" /> |
| 98 | + </TextBlock> |
| 99 | + |
91 | 100 | <ComboBox |
92 | 101 | HorizontalAlignment="Stretch" |
93 | 102 | ItemsSource="{x:Bind vm:MainViewModel.Entities}" |
|
147 | 156 | HorizontalAlignment="Stretch" |
148 | 157 | VerticalAlignment="Bottom" |
149 | 158 | Command="{x:Bind ViewModel.LoadCommand}" |
150 | | - Content="Load" /> |
| 159 | + Content="Load" |
| 160 | + IsEnabled="{x:Bind ViewModel.IsBusy, Mode=OneWay, Converter={StaticResource BoolNegationConverter}}" /> |
151 | 161 |
|
152 | 162 | <!-- Graph Explorer --> |
153 | 163 | <TextBox |
|
165 | 175 | HorizontalAlignment="Stretch" |
166 | 176 | VerticalAlignment="Stretch" |
167 | 177 | Command="{x:Bind ViewModel.LaunchGraphExplorerCommand}" |
168 | | - Content="Graph Explorer" /> |
| 178 | + Content="Graph Explorer" |
| 179 | + IsEnabled="{x:Bind ViewModel.IsBusy, Mode=OneWay, Converter={StaticResource BoolNegationConverter}}" /> |
169 | 180 | </Grid> |
170 | 181 |
|
171 | 182 | <!-- Query Results --> |
|
195 | 206 | </i:Interaction.Behaviors> |
196 | 207 | </controls:DataGrid> |
197 | 208 |
|
198 | | - <Grid |
199 | | - Grid.Row="2" |
200 | | - Margin="6" |
201 | | - Background="{ThemeResource AcrylicBackgroundFillColorBaseBrush}"> |
| 209 | + <Grid Grid.Row="2" Margin="6"> |
202 | 210 | <Grid.ColumnDefinitions> |
203 | 211 | <ColumnDefinition Width="Auto" /> |
204 | 212 | <ColumnDefinition Width="Auto" /> |
|
209 | 217 | <TextBlock |
210 | 218 | Margin="6,0" |
211 | 219 | VerticalAlignment="Center" |
212 | | - Text="{x:Bind sys:String.Format('Hello {0}', ViewModel.UserName), Mode=OneWay}" /> |
| 220 | + Text="{x:Bind ViewModel.UserName, Mode=OneWay, Converter={StaticResource StringFormatConverter}, ConverterParameter='Hello {0}'}" /> |
213 | 221 |
|
214 | | - <!--<Button Grid.Column="2" |
215 | | - Margin="0,0,6,0" |
216 | | - Padding="6,0" |
217 | | - Command="{x:Bind ViewModel.LogoutCommand}" |
218 | | - Content="Logout" />--> |
| 222 | + <Button |
| 223 | + Grid.Column="1" |
| 224 | + Margin="6,0" |
| 225 | + Padding="6,0" |
| 226 | + Command="{x:Bind ViewModel.LogoutCommand}" |
| 227 | + Content="Logout" /> |
219 | 228 |
|
220 | 229 | <ProgressBar |
221 | 230 | Grid.Column="2" |
222 | | - Margin="0,0,6,0" |
223 | | - HorizontalContentAlignment="Stretch" |
224 | | - IsIndeterminate="{x:Bind ViewModel.IsBusy, Mode=OneWay}" |
| 231 | + Margin="6,0" |
| 232 | + VerticalAlignment="Center" |
| 233 | + IsIndeterminate="{x:Bind ViewModel.IsIndeterminate, Mode=OneWay}" |
225 | 234 | ShowError="{x:Bind ViewModel.IsError, Mode=OneWay}" /> |
226 | 235 |
|
227 | 236 | <TextBlock |
228 | 237 | Grid.Column="3" |
229 | | - Margin="0,0,6,0" |
230 | | - Text="{x:Bind sys:String.Format('{0:N0} ms', ViewModel.ElapsedMs), Mode=OneWay}" /> |
| 238 | + Margin="6,0" |
| 239 | + Text="{x:Bind ViewModel.ElapsedMs, Mode=OneWay, Converter={StaticResource StringFormatConverter}, ConverterParameter='{}{0:N0} ms'}" /> |
231 | 240 | </Grid> |
232 | 241 | </Grid> |
233 | 242 | </Page> |
0 commit comments