mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-15 19:35:06 +00:00
Avalonia 12
This commit is contained in:
parent
db9abd228d
commit
cf6131f59e
13 changed files with 89 additions and 64 deletions
|
|
@ -16,7 +16,7 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia" Version="11.3.13" />
|
||||
<PackageReference Include="Avalonia" Version="12.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="10.0.5" />
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="10.0.5" />
|
||||
</ItemGroup>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ namespace MapControl
|
|||
if (e.Pointer.Type != PointerType.Mouse &&
|
||||
ItemsControl.ItemsControlFromItemContainer(this) is MapItemsControl mapItemsControl)
|
||||
{
|
||||
mapItemsControl.UpdateSelection(this, e);
|
||||
mapItemsControl.UpdateSelectionFromEvent(this, e);
|
||||
}
|
||||
|
||||
e.Handled = true;
|
||||
|
|
@ -22,7 +22,7 @@ namespace MapControl
|
|||
e.InitialPressMouseButton == MouseButton.Left &&
|
||||
ItemsControl.ItemsControlFromItemContainer(this) is MapItemsControl mapItemsControl)
|
||||
{
|
||||
mapItemsControl.UpdateSelection(this, e);
|
||||
mapItemsControl.UpdateSelectionFromEvent(this, e);
|
||||
}
|
||||
|
||||
e.Handled = true;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
using Avalonia.Controls;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Presenters;
|
||||
using Avalonia.Controls.Templates;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Media;
|
||||
|
||||
namespace MapControl
|
||||
|
|
@ -52,17 +54,22 @@ namespace MapControl
|
|||
ClearContainer((MapItem)container);
|
||||
}
|
||||
|
||||
internal void UpdateSelection(MapItem mapItem, PointerEventArgs e)
|
||||
protected override bool ShouldTriggerSelection(Visual selectable, PointerEventArgs eventArgs)
|
||||
{
|
||||
if (SelectionMode != SelectionMode.Single &&
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool UpdateSelectionFromEvent(UIElement container, RoutedEventArgs eventArgs)
|
||||
{
|
||||
if (SelectionMode == SelectionMode.Multiple &&
|
||||
eventArgs is PointerEventArgs e &&
|
||||
e.KeyModifiers.HasFlag(KeyModifiers.Shift))
|
||||
{
|
||||
SelectItemsInRange(mapItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateSelection(mapItem, true, false, e.KeyModifiers.HasFlag(KeyModifiers.Control));
|
||||
SelectItemsInRange((MapItem)container);
|
||||
return true;
|
||||
}
|
||||
|
||||
return base.UpdateSelectionFromEvent(container, eventArgs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue