MainWindow.xaml (5539B)
1 <Window x:Class="DriverUpdater.MainWindow" 2 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 3 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 4 Title="Driver Updater" Width="1100" Height="600" MinWidth="800" MinHeight="400" 5 WindowStartupLocation="CenterScreen" 6 Style="{StaticResource {x:Type Window}}"> 7 <Window.Resources> 8 <!-- Cell text, centered in the row to line up with the checkbox and the link. --> 9 <Style x:Key="CellText" TargetType="TextBlock" BasedOn="{x:Static DataGridTextColumn.DefaultElementStyle}"> 10 <Setter Property="VerticalAlignment" Value="Center" /> 11 </Style> 12 <!-- Failure messages can run long, so the status wraps onto as many lines as it needs. --> 13 <Style x:Key="StatusText" TargetType="TextBlock" BasedOn="{StaticResource CellText}"> 14 <Setter Property="TextWrapping" Value="Wrap" /> 15 <Setter Property="Margin" Value="0,4" /> 16 </Style> 17 </Window.Resources> 18 19 <Grid Margin="16"> 20 <Grid.RowDefinitions> 21 <RowDefinition Height="Auto" /> 22 <RowDefinition Height="*" /> 23 <RowDefinition Height="Auto" /> 24 </Grid.RowDefinitions> 25 26 <StackPanel Orientation="Horizontal"> 27 <Button x:Name="ScanButton" Content="Scan" Click="Scan_Click" MinWidth="90" /> 28 <Button x:Name="InstallButton" Content="Install selected" Click="Install_Click" 29 Style="{StaticResource AccentButtonStyle}" Margin="8,0,0,0" IsEnabled="False" /> 30 <CheckBox x:Name="RestorePointBox" Content="Create a restore point first" IsChecked="True" 31 Margin="16,0,0,0" VerticalAlignment="Center" /> 32 </StackPanel> 33 34 <DataGrid x:Name="UpdatesGrid" Grid.Row="1" Margin="0,12" 35 AutoGenerateColumns="False" CanUserAddRows="False" HeadersVisibility="Column" 36 SelectionMode="Single" GridLinesVisibility="None"> 37 <DataGrid.Columns> 38 <DataGridTemplateColumn Width="Auto"> 39 <DataGridTemplateColumn.CellTemplate> 40 <DataTemplate> 41 <CheckBox IsChecked="{Binding IsSelected, UpdateSourceTrigger=PropertyChanged}" 42 IsEnabled="{Binding CanInstall}" HorizontalAlignment="Center" /> 43 </DataTemplate> 44 </DataGridTemplateColumn.CellTemplate> 45 </DataGridTemplateColumn> 46 <DataGridTextColumn Header="Device" Binding="{Binding Device}" Width="*" MinWidth="180" IsReadOnly="True" 47 ElementStyle="{StaticResource CellText}" /> 48 <DataGridTextColumn Header="Source" Binding="{Binding Source}" Width="Auto" IsReadOnly="True" 49 ElementStyle="{StaticResource CellText}" /> 50 <DataGridTextColumn Header="Installed" Binding="{Binding InstalledVersion}" Width="Auto" IsReadOnly="True" 51 ElementStyle="{StaticResource CellText}" /> 52 <DataGridTextColumn Header="Available" Binding="{Binding AvailableVersion}" Width="Auto" IsReadOnly="True" 53 ElementStyle="{StaticResource CellText}" /> 54 <DataGridTextColumn Header="Released" Binding="{Binding ReleaseDate, StringFormat=yyyy-MM-dd}" Width="Auto" IsReadOnly="True" 55 ElementStyle="{StaticResource CellText}" /> 56 <DataGridTextColumn Header="Size" Binding="{Binding SizeText}" Width="Auto" IsReadOnly="True" 57 ElementStyle="{StaticResource CellText}" /> 58 <DataGridTextColumn Header="Status" Binding="{Binding Status}" Width="1.6*" MinWidth="160" IsReadOnly="True" 59 ElementStyle="{StaticResource StatusText}" /> 60 <DataGridTemplateColumn Header="Notes" Width="Auto"> 61 <DataGridTemplateColumn.CellTemplate> 62 <DataTemplate> 63 <TextBlock VerticalAlignment="Center"> 64 <TextBlock.Style> 65 <Style TargetType="TextBlock" BasedOn="{StaticResource {x:Type TextBlock}}"> 66 <Style.Triggers> 67 <DataTrigger Binding="{Binding NotesUrl}" Value="{x:Null}"> 68 <Setter Property="Visibility" Value="Collapsed" /> 69 </DataTrigger> 70 </Style.Triggers> 71 </Style> 72 </TextBlock.Style> 73 <Hyperlink NavigateUri="{Binding NotesUrl}" RequestNavigate="Link_RequestNavigate">Details</Hyperlink> 74 </TextBlock> 75 </DataTemplate> 76 </DataGridTemplateColumn.CellTemplate> 77 </DataGridTemplateColumn> 78 </DataGrid.Columns> 79 </DataGrid> 80 81 <StackPanel Grid.Row="2" Orientation="Horizontal"> 82 <ProgressBar x:Name="BusyBar" IsIndeterminate="True" Width="120" Margin="0,0,12,0" 83 VerticalAlignment="Center" Visibility="Collapsed" /> 84 <TextBlock x:Name="StatusText" VerticalAlignment="Center" /> 85 </StackPanel> 86 </Grid> 87 </Window>