From 4f161701bd1713fe5f2b88a420fb04eb1b7591f8 Mon Sep 17 00:00:00 2001 From: Maksym Katsydan Date: Sun, 13 Sep 2020 05:01:33 -0400 Subject: [PATCH] Do not override BindingMode in the DataGridBoundColumn --- src/Avalonia.Controls.DataGrid/DataGridBoundColumn.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Avalonia.Controls.DataGrid/DataGridBoundColumn.cs b/src/Avalonia.Controls.DataGrid/DataGridBoundColumn.cs index 8e82bf1a38..440a277a10 100644 --- a/src/Avalonia.Controls.DataGrid/DataGridBoundColumn.cs +++ b/src/Avalonia.Controls.DataGrid/DataGridBoundColumn.cs @@ -49,8 +49,13 @@ namespace Avalonia.Controls { if(_binding is Avalonia.Data.Binding binding) { + if (binding.Mode == BindingMode.OneWayToSource) + { + throw new InvalidOperationException("DataGridColumn doesn't support BindingMode.OneWayToSource"); + } + // Force the TwoWay binding mode if there is a Path present. TwoWay binding requires a Path. - if (!String.IsNullOrEmpty(binding.Path)) + if (!String.IsNullOrEmpty(binding.Path) && binding.Mode == BindingMode.Default) { binding.Mode = BindingMode.TwoWay; }