summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF/Views/MainView.xaml.cs
diff options
context:
space:
mode:
authorsr55 <[email protected]>2016-07-15 21:55:11 +0100
committersr55 <[email protected]>2016-07-15 21:56:08 +0100
commit5fce5ceecf4936e849d29b7e5c33cb12203e490d (patch)
treea9be38d9f3df815dc9a456276e7cf09fb70940dd /win/CS/HandBrakeWPF/Views/MainView.xaml.cs
parent56c7ee7486b338f56812ae153178757c43dc0f9c (diff)
WinGui: Change the Add to queue split button so that it's styling behaves a bit better. Fixes #99
Diffstat (limited to 'win/CS/HandBrakeWPF/Views/MainView.xaml.cs')
-rw-r--r--win/CS/HandBrakeWPF/Views/MainView.xaml.cs30
1 files changed, 30 insertions, 0 deletions
diff --git a/win/CS/HandBrakeWPF/Views/MainView.xaml.cs b/win/CS/HandBrakeWPF/Views/MainView.xaml.cs
index 7366ac9f8..53381b749 100644
--- a/win/CS/HandBrakeWPF/Views/MainView.xaml.cs
+++ b/win/CS/HandBrakeWPF/Views/MainView.xaml.cs
@@ -9,8 +9,13 @@
namespace HandBrakeWPF.Views
{
+ using System;
using System.Windows;
using System.Windows.Controls;
+ using System.Windows.Input;
+ using System.Windows.Media;
+
+ using HandBrakeWPF.ViewModels.Interfaces;
/// <summary>
/// Interaction logic for MainView.xaml
@@ -47,5 +52,30 @@ namespace HandBrakeWPF.Views
}
}
}
+
+ private void AddToQueue_PreviewMouseDown(object sender, MouseButtonEventArgs e)
+ {
+ // If we've clicked the dropdown part of the button, display the context menu below the button.
+ Button button = (sender as Button);
+ if (button != null)
+ {
+ HitTestResult result = VisualTreeHelper.HitTest(button, e.GetPosition(button));
+ FrameworkElement element = result.VisualHit as FrameworkElement;
+ if (element != null)
+ {
+ if (element.Name == "dropdown" || element.Name == "dropdownArrow")
+ {
+ button.ContextMenu.IsEnabled = true;
+ button.ContextMenu.PlacementTarget = button;
+ button.ContextMenu.Placement = System.Windows.Controls.Primitives.PlacementMode.Bottom;
+ button.ContextMenu.IsOpen = true;
+ return;
+ }
+ }
+ }
+
+ // Otherwise assume it's a main area click and add to queue.
+ ((IMainViewModel)this.DataContext).AddToQueue();
+ }
}
}