Browse Source
Merge pull request #4663 from AvaloniaUI/fixes/datagridcolumn-do-not-override-binding-mode
Do not override BindingMode in the DataGridBoundColumn
pull/4691/head
danwalmsley
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
6 additions and
2 deletions
-
src/Avalonia.Controls.DataGrid/DataGridBoundColumn.cs
|
|
|
@ -49,8 +49,12 @@ namespace Avalonia.Controls |
|
|
|
{ |
|
|
|
if(_binding is Avalonia.Data.Binding binding) |
|
|
|
{ |
|
|
|
// Force the TwoWay binding mode if there is a Path present. TwoWay binding requires a Path.
|
|
|
|
if (!String.IsNullOrEmpty(binding.Path)) |
|
|
|
if (binding.Mode == BindingMode.OneWayToSource) |
|
|
|
{ |
|
|
|
throw new InvalidOperationException("DataGridColumn doesn't support BindingMode.OneWayToSource. Use BindingMode.TwoWay instead."); |
|
|
|
} |
|
|
|
|
|
|
|
if (!String.IsNullOrEmpty(binding.Path) && binding.Mode == BindingMode.Default) |
|
|
|
{ |
|
|
|
binding.Mode = BindingMode.TwoWay; |
|
|
|
} |
|
|
|
|