summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF/Views
diff options
context:
space:
mode:
authorsr55 <[email protected]>2012-06-16 16:29:23 +0000
committersr55 <[email protected]>2012-06-16 16:29:23 +0000
commitebb9137df0b40c10e5514522a9f6379fad789930 (patch)
treeb9141ed719dce917a2b69e231f02006206c519a4 /win/CS/HandBrakeWPF/Views
parentff27427d20803a01800a288fbd3d8426cab7eb56 (diff)
WinGui: Convert the Presets Panel to a Listbox and update the styling. This should better reflect the selected preset and cleanup the horrible toolbar styling for the button controls.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4741 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrakeWPF/Views')
-rw-r--r--win/CS/HandBrakeWPF/Views/MainView.xaml67
-rw-r--r--win/CS/HandBrakeWPF/Views/MainView.xaml.cs24
2 files changed, 71 insertions, 20 deletions
diff --git a/win/CS/HandBrakeWPF/Views/MainView.xaml b/win/CS/HandBrakeWPF/Views/MainView.xaml
index 9f3c65ee6..3c2963378 100644
--- a/win/CS/HandBrakeWPF/Views/MainView.xaml
+++ b/win/CS/HandBrakeWPF/Views/MainView.xaml
@@ -5,7 +5,7 @@
xmlns:Converters="clr-namespace:HandBrakeWPF.Converters"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:Micro="clr-namespace:Caliburn.Micro;assembly=Caliburn.Micro"
- AllowDrop="True"
+ xmlns:behaviours="clr-namespace:HandBrakeWPF.Helpers" AllowDrop="True"
Background="#FFF0F0F0"
FontSize="11"
Micro:Message.Attach="[Event Loaded] = [Action Load]"
@@ -63,16 +63,31 @@
<TextBlock FontWeight="Bold" Text="{Binding Path=Name}" />
</HierarchicalDataTemplate>
- <Style TargetType="TreeViewItem">
- <Setter Property="IsExpanded" Value="True" />
+ <Style TargetType="ListBoxItem">
<Setter Property="Padding" Value="0,2,0,2" />
<Style.Triggers>
<DataTrigger Binding="{Binding IsBuildIn}" Value="True">
<Setter Property="Foreground" Value="DarkBlue" />
</DataTrigger>
+ <Trigger Property="IsSelected" Value="True">
+ <Setter Property="FontWeight" Value="Bold"/>
+ <Setter Property="Background" Value="Transparent"/>
+ </Trigger>
</Style.Triggers>
</Style>
+ <Style x:Key="ContainerStyle" TargetType="{x:Type GroupItem}">
+ <Setter Property="Template">
+ <Setter.Value>
+ <ControlTemplate>
+ <Expander Header="{Binding Name}" IsExpanded="True">
+ <ItemsPresenter />
+ </Expander>
+ </ControlTemplate>
+ </Setter.Value>
+ </Setter>
+ </Style>
+
<Converters:BooleanToVisibilityConverter x:Key="boolToVisConverter" />
</UserControl.Resources>
@@ -131,7 +146,7 @@
<MenuItem Header="About..." Micro:Message.Attach="[Event Click] = [Action OpenAboutApplication]" />
</MenuItem>
- <MenuItem Header="Debug">
+ <MenuItem Header="Debug" Foreground="Transparent" >
<MenuItem Header="Show CLI Equiv" Micro:Message.Attach="[Event Click] = [Action ShowCliQuery]" />
</MenuItem>
</Menu>
@@ -390,6 +405,7 @@
</StackPanel>
</StackPanel>
</StackPanel>
+
<!-- Destination -->
<StackPanel Grid.Row="1"
Margin="10,5,5,5"
@@ -418,6 +434,7 @@
/>
</Grid>
</StackPanel>
+
<!-- Output Options -->
<StackPanel Grid.Row="2"
Margin="10,5,5,5"
@@ -462,6 +479,7 @@
/>
</StackPanel>
</StackPanel>
+
<!-- Tab Control -->
<TabControl Name="tabControl"
Grid.Row="3"
@@ -491,6 +509,7 @@
<ContentControl x:Name="AdvancedViewModel" />
</TabItem>
</TabControl>
+
<!-- Presets -->
<GroupBox Grid.RowSpan="4"
Grid.Column="1"
@@ -498,35 +517,43 @@
VerticalAlignment="Stretch"
Header="Presets"
Margin="0,0,0,5"
+ Background="White"
>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
- <TreeView HorizontalAlignment="Stretch"
- VerticalAlignment="Stretch"
- ItemsSource="{Binding Source={StaticResource presetsCvs},
- Path=Groups}"
- ItemTemplate="{StaticResource presetsCategoryTemplate}"
- >
- <i:Interaction.Triggers>
- <i:EventTrigger EventName="SelectedItemChanged">
- <Micro:ActionMessage MethodName="SetSelectedPreset">
- <Micro:Parameter Value="$eventArgs" />
- </Micro:ActionMessage>
- </i:EventTrigger>
- </i:Interaction.Triggers>
- </TreeView>
+
+ <ListBox HorizontalAlignment="Stretch"
+ VerticalAlignment="Stretch" ItemsSource="{Binding Source={StaticResource presetsCvs}}"
+ SelectedItem="{Binding SelectedPreset, Mode=TwoWay}" BorderThickness="0,0,0,1"
+ BorderBrush="LightGray"
+ >
+ <ListBox.GroupStyle>
+ <GroupStyle ContainerStyle="{StaticResource ContainerStyle}"/>
+ </ListBox.GroupStyle>
+
+ <ListBox.ItemTemplate>
+ <DataTemplate>
+ <TextBlock Text="{Binding Name}" Margin="24,0,0,0" Padding="8,1" />
+ </DataTemplate>
+ </ListBox.ItemTemplate>
+
+ </ListBox>
+
<ToolBar Name="presetsToolBar"
Grid.Row="1"
- HorizontalAlignment="Stretch"
+ HorizontalAlignment="Center"
VerticalAlignment="Stretch"
Background="Transparent"
SnapsToDevicePixels="False"
UseLayoutRounding="False"
+ ToolBar.OverflowMode="Never"
+ ToolBarTray.IsLocked="True"
+ Loaded="PresetsToolBarLoaded"
>
- <Button Micro:Message.Attach="[Event Click] = [Action PresetAdd]">
+ <Button Micro:Message.Attach="[Event Click] = [Action PresetAdd]" >
<Button.Content>
<StackPanel Orientation="Horizontal">
<Image Width="16"
diff --git a/win/CS/HandBrakeWPF/Views/MainView.xaml.cs b/win/CS/HandBrakeWPF/Views/MainView.xaml.cs
index 2845ff0f2..8b21e2d40 100644
--- a/win/CS/HandBrakeWPF/Views/MainView.xaml.cs
+++ b/win/CS/HandBrakeWPF/Views/MainView.xaml.cs
@@ -9,6 +9,7 @@
namespace HandBrakeWPF.Views
{
+ using System.Windows;
using System.Windows.Controls;
/// <summary>
@@ -23,5 +24,28 @@ namespace HandBrakeWPF.Views
{
InitializeComponent();
}
+
+ /// <summary>
+ /// Hide the overflow control on the Preset panel.
+ /// TODO find a better way of doing this. This seems to be the common solution.
+ /// </summary>
+ /// <param name="sender">
+ /// The sender.
+ /// </param>
+ /// <param name="e">
+ /// The e.
+ /// </param>
+ private void PresetsToolBarLoaded(object sender, RoutedEventArgs e)
+ {
+ ToolBar toolBar = sender as ToolBar;
+ if (toolBar != null)
+ {
+ var overflowGrid = toolBar.Template.FindName("OverflowGrid", toolBar) as FrameworkElement;
+ if (overflowGrid != null)
+ {
+ overflowGrid.Visibility = Visibility.Collapsed;
+ }
+ }
+ }
}
}