summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs11
-rw-r--r--win/CS/HandBrakeWPF/Views/MainView.xaml67
-rw-r--r--win/CS/HandBrakeWPF/Views/MainView.xaml.cs24
3 files changed, 71 insertions, 31 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
index 60272c057..c68cf1d6b 100644
--- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
@@ -1269,17 +1269,6 @@ namespace HandBrakeWPF.ViewModels
this.SelectedPreset = this.presetService.DefaultPreset;
}
- /// <summary>
- /// Set the selected preset.
- /// </summary>
- /// <param name="e">
- /// The RoutedPropertyChangedEventArgs.
- /// </param>
- public void SetSelectedPreset(RoutedPropertyChangedEventArgs<object> e)
- {
- this.SelectedPreset = e.NewValue as Preset;
- }
-
#endregion
#region Private Methods
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;
+ }
+ }
+ }
}
}