diff --git a/Gu.Wpf.DataGrid2D.Demo/Gu.Wpf.DataGrid2D.Demo.csproj b/Gu.Wpf.DataGrid2D.Demo/Gu.Wpf.DataGrid2D.Demo.csproj
index b38b9d7..4a42a7d 100644
--- a/Gu.Wpf.DataGrid2D.Demo/Gu.Wpf.DataGrid2D.Demo.csproj
+++ b/Gu.Wpf.DataGrid2D.Demo/Gu.Wpf.DataGrid2D.Demo.csproj
@@ -111,6 +111,15 @@
Array2DView.xaml
+
+ SingleClickEditView.xaml
+
+
+ SingleClickEditView.xaml
+
+
+ SingleClickEditView.xaml
+
TransposedView.xaml
@@ -166,6 +175,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
diff --git a/Gu.Wpf.DataGrid2D.Demo/MainWindow.xaml b/Gu.Wpf.DataGrid2D.Demo/MainWindow.xaml
index 930cb6b..3ea0d41 100644
--- a/Gu.Wpf.DataGrid2D.Demo/MainWindow.xaml
+++ b/Gu.Wpf.DataGrid2D.Demo/MainWindow.xaml
@@ -41,5 +41,9 @@
+
+
+
+
\ No newline at end of file
diff --git a/Gu.Wpf.DataGrid2D.Demo/SingleClickEditItem.cs b/Gu.Wpf.DataGrid2D.Demo/SingleClickEditItem.cs
new file mode 100644
index 0000000..b402bf0
--- /dev/null
+++ b/Gu.Wpf.DataGrid2D.Demo/SingleClickEditItem.cs
@@ -0,0 +1,75 @@
+namespace Gu.Wpf.DataGrid2D.Demo
+{
+ using System.ComponentModel;
+ using System.Runtime.CompilerServices;
+ using JetBrains.Annotations;
+
+ public class SingleClickEditItem : INotifyPropertyChanged
+ {
+ private string stringValue;
+ private int intValue;
+ private bool boolValue;
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ public string StringValue
+ {
+ get
+ {
+ return this.stringValue;
+ }
+
+ set
+ {
+ if (value == this.stringValue)
+ {
+ return;
+ }
+ this.stringValue = value;
+ this.OnPropertyChanged();
+ }
+ }
+
+ public int IntValue
+ {
+ get
+ {
+ return this.intValue;
+ }
+
+ set
+ {
+ if (value == this.intValue)
+ {
+ return;
+ }
+ this.intValue = value;
+ this.OnPropertyChanged();
+ }
+ }
+
+ public bool BoolValue
+ {
+ get
+ {
+ return this.boolValue;
+ }
+
+ set
+ {
+ if (value == this.boolValue)
+ {
+ return;
+ }
+ this.boolValue = value;
+ this.OnPropertyChanged();
+ }
+ }
+
+ [NotifyPropertyChangedInvocator]
+ protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
+ {
+ this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+ }
+ }
+}
\ No newline at end of file
diff --git a/Gu.Wpf.DataGrid2D.Demo/SingleClickEditView.xaml b/Gu.Wpf.DataGrid2D.Demo/SingleClickEditView.xaml
new file mode 100644
index 0000000..b9da643
--- /dev/null
+++ b/Gu.Wpf.DataGrid2D.Demo/SingleClickEditView.xaml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
diff --git a/Gu.Wpf.DataGrid2D.Demo/SingleClickEditView.xaml.cs b/Gu.Wpf.DataGrid2D.Demo/SingleClickEditView.xaml.cs
new file mode 100644
index 0000000..111ba81
--- /dev/null
+++ b/Gu.Wpf.DataGrid2D.Demo/SingleClickEditView.xaml.cs
@@ -0,0 +1,15 @@
+namespace Gu.Wpf.DataGrid2D.Demo
+{
+ using System.Windows.Controls;
+
+ ///
+ /// Interaction logic for SingleClickEditView.xaml
+ ///
+ public partial class SingleClickEditView : UserControl
+ {
+ public SingleClickEditView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Gu.Wpf.DataGrid2D.Demo/SingleClickEditViewModel.cs b/Gu.Wpf.DataGrid2D.Demo/SingleClickEditViewModel.cs
new file mode 100644
index 0000000..04e5f91
--- /dev/null
+++ b/Gu.Wpf.DataGrid2D.Demo/SingleClickEditViewModel.cs
@@ -0,0 +1,18 @@
+namespace Gu.Wpf.DataGrid2D.Demo
+{
+ using System.Collections.ObjectModel;
+
+ public class SingleClickEditViewModel
+ {
+ public SingleClickEditViewModel()
+ {
+ this.Items = new ObservableCollection
+ {
+ new SingleClickEditItem(),
+ new SingleClickEditItem(),
+ };
+ }
+
+ public ObservableCollection Items { get; }
+ }
+}
diff --git a/Gu.Wpf.DataGrid2D/Gu.Wpf.DataGrid2D.csproj b/Gu.Wpf.DataGrid2D/Gu.Wpf.DataGrid2D.csproj
index fbce9d3..e709e59 100644
--- a/Gu.Wpf.DataGrid2D/Gu.Wpf.DataGrid2D.csproj
+++ b/Gu.Wpf.DataGrid2D/Gu.Wpf.DataGrid2D.csproj
@@ -66,6 +66,7 @@
+
diff --git a/Gu.Wpf.DataGrid2D/SingleClick.cs b/Gu.Wpf.DataGrid2D/SingleClick.cs
new file mode 100644
index 0000000..9b0e44c
--- /dev/null
+++ b/Gu.Wpf.DataGrid2D/SingleClick.cs
@@ -0,0 +1,60 @@
+namespace Gu.Wpf.DataGrid2D
+{
+ using System.Linq;
+ using System.Windows;
+ using System.Windows.Controls;
+
+ public static class SingleClick
+ {
+ public static readonly DependencyProperty EditProperty = DependencyProperty.RegisterAttached(
+ "Edit",
+ typeof(bool),
+ typeof(SingleClick),
+ new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.Inherits));
+
+ static SingleClick()
+ {
+ EventManager.RegisterClassHandler(typeof(DataGridCell), UIElement.PreviewMouseLeftButtonDownEvent, new RoutedEventHandler(OnPreviewMouseLeftButtonDown));
+ }
+
+ public static void SetEdit(DependencyObject element, bool value)
+ {
+ element.SetValue(EditProperty, value);
+ }
+
+ public static bool GetEdit(DependencyObject element)
+ {
+ return (bool)element.GetValue(EditProperty);
+ }
+
+ private static void OnPreviewMouseLeftButtonDown(object sender, RoutedEventArgs e)
+ {
+ var cell = (DataGridCell)sender;
+ if (GetEdit(cell) && !cell.IsReadOnly && !cell.IsEditing)
+ {
+ var dataGrid = cell.Ancestors()
+ .OfType()
+ .FirstOrDefault();
+ if (dataGrid == null)
+ {
+ return;
+ }
+
+ dataGrid.BeginEdit();
+ if (dataGrid.SelectionUnit == DataGridSelectionUnit.FullRow)
+ {
+ cell.Ancestors()
+ .OfType()
+ .FirstOrDefault()
+ ?.SetCurrentValue(DataGridRow.IsSelectedProperty, true);
+ }
+ else
+ {
+ cell.SetCurrentValue(DataGridCell.IsSelectedProperty, true);
+ }
+
+ cell.Focus();
+ }
+ }
+ }
+}