From b73ca494e24ad83f8768946a5bd2e91a60d7d65e Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 18 Mar 2019 12:00:50 +0200 Subject: Implemented open dispensers & machine designer via double click. --- .../Tango.SharedUI/Controls/DoubleClickDataGrid.cs | 37 ++++++++++++++++++++++ .../Tango.SharedUI/Tango.SharedUI.csproj | 3 +- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 Software/Visual_Studio/Tango.SharedUI/Controls/DoubleClickDataGrid.cs (limited to 'Software/Visual_Studio/Tango.SharedUI') diff --git a/Software/Visual_Studio/Tango.SharedUI/Controls/DoubleClickDataGrid.cs b/Software/Visual_Studio/Tango.SharedUI/Controls/DoubleClickDataGrid.cs new file mode 100644 index 000000000..85b104aa8 --- /dev/null +++ b/Software/Visual_Studio/Tango.SharedUI/Controls/DoubleClickDataGrid.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; + +namespace Tango.SharedUI.Controls +{ + public class DoubleClickDataGrid : DataGrid + { + public ICommand DoubleClickCommand + { + get { return (ICommand)GetValue(DoubleClickCommandProperty); } + set { SetValue(DoubleClickCommandProperty, value); } + } + public static readonly DependencyProperty DoubleClickCommandProperty = + DependencyProperty.Register("DoubleClickCommand", typeof(ICommand), typeof(DoubleClickDataGrid), new PropertyMetadata(null)); + + + + public DoubleClickDataGrid() + { + this.MouseDoubleClick += DoubleClickDataGrid_MouseDoubleClick; + } + + private void DoubleClickDataGrid_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e) + { + if (SelectedItem != null) + { + DoubleClickCommand?.Execute(SelectedItem); + } + } + } +} diff --git a/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj b/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj index 65f2fe46b..a8bd06040 100644 --- a/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj +++ b/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj @@ -67,6 +67,7 @@ + HiveControl.xaml @@ -234,7 +235,7 @@ - + \ No newline at end of file -- cgit v1.3.1