diff options
author | sr55 <[email protected]> | 2016-07-30 11:47:34 +0100 |
---|---|---|
committer | sr55 <[email protected]> | 2016-07-30 11:47:40 +0100 |
commit | 327986c2fb0294e77c72e4f40e9cdd071d05ad13 (patch) | |
tree | ad456f1333918a045529df8c5a49e7aa8bc0111d /win/CS | |
parent | 40fbf61af177aebbe75d2d38c13ca29dfc448ec0 (diff) |
WinGui: Refix styling and layout on the Drive Listbox so it scrolls correctly. Fixes #263
Diffstat (limited to 'win/CS')
-rw-r--r-- | win/CS/HandBrakeWPF/Controls/SourceSelection.xaml | 103 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/Styles/Styles.xaml | 36 |
2 files changed, 85 insertions, 54 deletions
diff --git a/win/CS/HandBrakeWPF/Controls/SourceSelection.xaml b/win/CS/HandBrakeWPF/Controls/SourceSelection.xaml index f73103b88..b719957e6 100644 --- a/win/CS/HandBrakeWPF/Controls/SourceSelection.xaml +++ b/win/CS/HandBrakeWPF/Controls/SourceSelection.xaml @@ -3,16 +3,16 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:cal="http://www.caliburnproject.org"
xmlns:controls="clr-namespace:HandBrakeWPF.Controls"
- xmlns:Properties="clr-namespace:HandBrakeWPF.Properties">
+ xmlns:Properties="clr-namespace:HandBrakeWPF.Properties" x:Name="sourcePanel">
+
+ <Grid Height="{Binding ElementName=sourcePanel, Path=ActualHeight}">
- <Grid VerticalAlignment="Stretch">
-
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
- <Grid VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Grid.Column="0" Width="300" Background="{Binding Path=Background, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}">
+ <Grid VerticalAlignment="Stretch" Grid.Column="0" Width="300" Background="{Binding Path=Background, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
@@ -20,8 +20,10 @@ <RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
</Grid.RowDefinitions>
-
+
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="30" />
@@ -44,67 +46,60 @@ <TextBlock Text="{x:Static Properties:ResourcesUI.SourceSelection_ChooseVideo}" Margin="0,10,0,0" />
</StackPanel>
- <!-- Source Type -->
- <Grid Grid.Row="2" HorizontalAlignment="Left" Margin="20,5,0,0">
-
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- <RowDefinition Height="*" />
- </Grid.RowDefinitions>
-
- <!-- Ctrl + R -->
- <Button Grid.Row="0" AutomationProperties.Name="{x:Static Properties:ResourcesUI.SourceSelection_ChooseFolder}" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" cal:Message.Attach="[Event Click] = [Action FolderScan]"
- Margin="0,0,0,7" Padding="8" HorizontalAlignment="Left">
-
- <StackPanel Orientation="Horizontal" MinWidth="100">
- <Image Source="../Views/Images/folder32.png" Width="32" />
- <StackPanel Orientation="Vertical">
- <TextBlock Text="{x:Static Properties:ResourcesUI.SourceSelection_FolderBatchScan}" VerticalAlignment="Center" Margin="5,0,0,0" />
- <TextBlock Text="{x:Static Properties:ResourcesUI.SourceSelection_OpenFolderWIth}" VerticalAlignment="Center" Margin="5,0,0,0" />
- </StackPanel>
+ <!-- Source Types -->
+
+ <!-- Ctrl + R -->
+ <Button Grid.Row="2" AutomationProperties.Name="{x:Static Properties:ResourcesUI.SourceSelection_ChooseFolder}" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" cal:Message.Attach="[Event Click] = [Action FolderScan]"
+ Margin="20,5,0,0" Padding="8" HorizontalAlignment="Left">
+
+ <StackPanel Orientation="Horizontal" MinWidth="100">
+ <Image Source="../Views/Images/folder32.png" Width="32" />
+ <StackPanel Orientation="Vertical">
+ <TextBlock Text="{x:Static Properties:ResourcesUI.SourceSelection_FolderBatchScan}" VerticalAlignment="Center" Margin="5,0,0,0" />
+ <TextBlock Text="{x:Static Properties:ResourcesUI.SourceSelection_OpenFolderWIth}" VerticalAlignment="Center" Margin="5,0,0,0" />
</StackPanel>
- </Button>
-
- <!--Ctrl + F-->
- <Button Grid.Row="1" AutomationProperties.Name="{x:Static Properties:ResourcesUI.SourceSelection_ChooseFile}" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" cal:Message.Attach="[Event Click] = [Action FileScan]"
- Margin="0,0,0,7" Padding="8" HorizontalAlignment="Left">
- <StackPanel Orientation="Horizontal" MinWidth="100">
- <Image Source="../Views/Images/File32.png" Width="32" />
- <StackPanel Orientation="Vertical">
- <TextBlock Text="{x:Static Properties:ResourcesUI.SourceSelection_File}" VerticalAlignment="Center" Margin="5,0,0,0" />
- <TextBlock Text="{x:Static Properties:ResourcesUI.SourceSelection_SingleVideoFile}" VerticalAlignment="Center" Margin="5,0,0,0" />
- </StackPanel>
+ </StackPanel>
+ </Button>
+
+ <!--Ctrl + F-->
+ <Button Grid.Row="3" AutomationProperties.Name="{x:Static Properties:ResourcesUI.SourceSelection_ChooseFile}" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" cal:Message.Attach="[Event Click] = [Action FileScan]"
+ Margin="20,5,0,0" Padding="8" HorizontalAlignment="Left">
+ <StackPanel Orientation="Horizontal" MinWidth="100">
+ <Image Source="../Views/Images/File32.png" Width="32" />
+ <StackPanel Orientation="Vertical">
+ <TextBlock Text="{x:Static Properties:ResourcesUI.SourceSelection_File}" VerticalAlignment="Center" Margin="5,0,0,0" />
+ <TextBlock Text="{x:Static Properties:ResourcesUI.SourceSelection_SingleVideoFile}" VerticalAlignment="Center" Margin="5,0,0,0" />
</StackPanel>
- </Button>
+ </StackPanel>
+ </Button>
- <ListBox Grid.Row="2" ItemsSource="{Binding Drives}" Background="Transparent" BorderThickness="0">
- <ListBox.ItemTemplate>
- <DataTemplate>
- <Button Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
+ <ListBox Grid.Row="4" ItemsSource="{Binding Drives}" Background="Transparent" BorderThickness="0" Margin="16,5,0,0" ItemContainerStyle="{StaticResource hoverlessListBoxItemStyle}">
+ <ListBox.ItemTemplate>
+ <DataTemplate>
+ <Button Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
cal:Message.Attach="[Event Click] = [Action ProcessDrive($this.Tag)]"
Margin="0,0,0,10" Padding="8" HorizontalAlignment="Left"
Tag="{Binding}" AutomationProperties.Name="{x:Static Properties:ResourcesUI.SourceSelection_ChooseDisc}">
- <StackPanel Orientation="Horizontal" MinWidth="100">
- <Image Source="../Views/Images/Disc.png" Width="32" />
- <StackPanel Orientation="Vertical">
- <TextBlock Text="{Binding Text}" VerticalAlignment="Center" Margin="5,0,0,0" />
- <TextBlock Text="{x:Static Properties:ResourcesUI.SourceSelection_OpenDVDBluray}" VerticalAlignment="Center" Margin="5,0,0,0" />
- </StackPanel>
+ <StackPanel Orientation="Horizontal" MinWidth="100">
+ <Image Source="../Views/Images/Disc.png" Width="32" />
+ <StackPanel Orientation="Vertical">
+ <TextBlock Text="{Binding Text}" VerticalAlignment="Center" Margin="5,0,0,0" />
+ <TextBlock Text="{x:Static Properties:ResourcesUI.SourceSelection_OpenDVDBluray}" VerticalAlignment="Center" Margin="5,0,0,0" />
</StackPanel>
- </Button>
- </DataTemplate>
- </ListBox.ItemTemplate>
+ </StackPanel>
+ </Button>
+ </DataTemplate>
+ </ListBox.ItemTemplate>
+
+ </ListBox>
- </ListBox>
- </Grid>
<!-- Cancel Window -->
- <StackPanel Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,10,2,10">
+ <StackPanel Grid.Row="5" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,10,2,10">
<Button cal:Message.Attach="[Event Click] = [Action CloseSourceSelection]" Content="Cancel" Padding="8,2" />
</StackPanel>
- <StackPanel Grid.Row="5" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,10,2,10">
+ <StackPanel Grid.Row="7" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,10,2,10">
<TextBlock>
<Hyperlink x:Name="Preferences" NavigateUri="/" RequestNavigate="OpenOptions_OnRequestNavigate" >Preferences</Hyperlink>
</TextBlock>
@@ -119,7 +114,7 @@ </StackPanel>
</Grid>
-
+
<StackPanel Grid.Column="1" Background="Black" Opacity="0.5" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
</Grid>
diff --git a/win/CS/HandBrakeWPF/Views/Styles/Styles.xaml b/win/CS/HandBrakeWPF/Views/Styles/Styles.xaml index 66eb49078..c121190a5 100644 --- a/win/CS/HandBrakeWPF/Views/Styles/Styles.xaml +++ b/win/CS/HandBrakeWPF/Views/Styles/Styles.xaml @@ -52,4 +52,40 @@ </Setter>
</Style>
+ <Style x:Key="hoverlessListBoxItemStyle" TargetType="{x:Type ListBoxItem}">
+ <Setter Property="Background" Value="Transparent"/>
+ <Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
+ <Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
+ <Setter Property="Padding" Value="2,0,0,0"/>
+ <Setter Property="Template">
+ <Setter.Value>
+ <ControlTemplate TargetType="{x:Type ListBoxItem}">
+ <Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
+ <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
+ </Border>
+ <ControlTemplate.Triggers>
+ <Trigger Property="IsSelected" Value="true">
+ <Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
+ <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}"/>
+ </Trigger>
+ <MultiTrigger>
+ <MultiTrigger.Conditions>
+ <Condition Property="IsSelected" Value="true"/>
+ <Condition Property="Selector.IsSelectionActive" Value="false"/>
+ </MultiTrigger.Conditions>
+ <Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}"/>
+ <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightTextBrushKey}}"/>
+ </MultiTrigger>
+ <Trigger Property="IsEnabled" Value="false">
+ <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
+ </Trigger>
+ <Trigger Property="IsMouseOver" Value="True">
+ <Setter Property="Background" Value="Transparent"/>
+ </Trigger>
+ </ControlTemplate.Triggers>
+ </ControlTemplate>
+ </Setter.Value>
+ </Setter>
+ </Style>
+
</ResourceDictionary>
\ No newline at end of file |