Browse Source

Merge pull request #4871 from YohDeadfall/removed-dead-code

Removed dead code and simplified some conditions
pull/4884/head
Dariusz Komosiński 6 years ago
committed by GitHub
parent
commit
fd5002107d
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 20
      src/Avalonia.Controls/Primitives/SelectingItemsControl.cs

20
src/Avalonia.Controls/Primitives/SelectingItemsControl.cs

@ -790,18 +790,13 @@ namespace Avalonia.Controls.Primitives
/// <param name="e">The event.</param>
private void ContainerSelectionChanged(RoutedEventArgs e)
{
if (!_ignoreContainerSelectionChanged)
if (!_ignoreContainerSelectionChanged &&
e.Source is IControl control &&
e.Source is ISelectable selectable &&
control.LogicalParent == this &&
ItemContainerGenerator?.IndexFromContainer(control) != -1)
{
var control = e.Source as IControl;
var selectable = e.Source as ISelectable;
if (control != null &&
selectable != null &&
control.LogicalParent == this &&
ItemContainerGenerator?.IndexFromContainer(control) != -1)
{
UpdateSelection(control, selectable.IsSelected);
}
UpdateSelection(control, selectable.IsSelected);
}
if (e.Source != this)
@ -820,12 +815,11 @@ namespace Avalonia.Controls.Primitives
{
try
{
var selectable = container as ISelectable;
bool result;
_ignoreContainerSelectionChanged = true;
if (selectable != null)
if (container is ISelectable selectable)
{
result = selectable.IsSelected;
selectable.IsSelected = selected;

Loading…
Cancel
Save