Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove obsolete API usage from SelectingItemsControl. #16220

Merged
merged 1 commit into from
Jul 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/Avalonia.Controls/Primitives/SelectingItemsControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Linq;
using Avalonia.Controls.Selection;
using Avalonia.Data;
using Avalonia.Data.Core;
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.Metadata;
Expand Down Expand Up @@ -1387,6 +1388,9 @@ private class UpdateState
/// </summary>
private class BindingHelper : StyledElement
{
private BindingExpressionBase? _expression;
private IBinding? _lastBinding;

public BindingHelper(IBinding binding)
{
UpdateBinding(binding);
Expand All @@ -1406,17 +1410,13 @@ public BindingHelper(IBinding binding)

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;
}
}
}
Loading