Steven Kirk
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
9 additions and
9 deletions
-
src/Avalonia.Controls/Primitives/SelectingItemsControl.cs
|
|
|
@ -6,6 +6,7 @@ using System.Diagnostics.CodeAnalysis; |
|
|
|
using System.Linq; |
|
|
|
using Avalonia.Controls.Selection; |
|
|
|
using Avalonia.Data; |
|
|
|
using Avalonia.Data.Core; |
|
|
|
using Avalonia.Input; |
|
|
|
using Avalonia.Interactivity; |
|
|
|
using Avalonia.Metadata; |
|
|
|
@ -1387,6 +1388,9 @@ namespace Avalonia.Controls.Primitives |
|
|
|
/// </summary>
|
|
|
|
private class BindingHelper : StyledElement |
|
|
|
{ |
|
|
|
private BindingExpressionBase? _expression; |
|
|
|
private IBinding? _lastBinding; |
|
|
|
|
|
|
|
public BindingHelper(IBinding binding) |
|
|
|
{ |
|
|
|
UpdateBinding(binding); |
|
|
|
@ -1406,17 +1410,13 @@ namespace Avalonia.Controls.Primitives |
|
|
|
|
|
|
|
public void UpdateBinding(IBinding binding) |
|
|
|
{ |
|
|
|
_lastBinding = binding; |
|
|
|
var ib = binding.Initiate(this, ValueProperty); |
|
|
|
if (ib is null) |
|
|
|
{ |
|
|
|
throw new InvalidOperationException("Unable to create binding"); |
|
|
|
} |
|
|
|
if (binding == _lastBinding) |
|
|
|
return; |
|
|
|
|
|
|
|
BindingOperations.Apply(this, ValueProperty, ib, null); |
|
|
|
_expression?.Dispose(); |
|
|
|
_expression = Bind(ValueProperty, binding); |
|
|
|
_lastBinding = binding; |
|
|
|
} |
|
|
|
|
|
|
|
private IBinding? _lastBinding; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|