mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Meta - Update packages
Shared UI - Added slider behavior that only updates its value on pointer release
This commit is contained in:
1 parent
3e1fc76bfe
commit
cce8404cfa
12 files changed
+133
-74
No files matched your search
@@ -21,7 +21,7 @@
|
||||
<PackageReference Include="Avalonia" Version="0.10.13" />
|
||||
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.13" />
|
||||
<PackageReference Include="Avalonia.Svg.Skia" Version="0.10.12" />
|
||||
<PackageReference Include="Avalonia.Xaml.Behaviors" Version="0.10.13.2" />
|
||||
<PackageReference Include="Avalonia.Xaml.Behaviors" Version="0.10.13.3" />
|
||||
<PackageReference Include="DynamicData" Version="7.5.4" />
|
||||
<PackageReference Include="FluentAvaloniaUI" Version="1.3.4" />
|
||||
<PackageReference Include="Material.Icons.Avalonia" Version="1.0.2" />
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Data;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Xaml.Interactivity;
|
||||
using FluentAvalonia.UI.Controls;
|
||||
|
||||
namespace Artemis.UI.Shared.Behaviors;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a behavior that can be used to make a slider only update it's binding on pointer release.
|
||||
/// </summary>
|
||||
public class SliderPointerReleasedBindingBehavior : Behavior<Slider>
|
||||
{
|
||||
public static readonly StyledProperty<double> ValueProperty = AvaloniaProperty.Register<LostFocusTextBoxBindingBehavior, double>(
|
||||
nameof(Value), defaultBindingMode: BindingMode.TwoWay);
|
||||
|
||||
static SliderPointerReleasedBindingBehavior()
|
||||
{
|
||||
ValueProperty.Changed.Subscribe(e => ((SliderPointerReleasedBindingBehavior) e.Sender).OnBindingValueChanged());
|
||||
}
|
||||
|
||||
public double Value
|
||||
{
|
||||
get => GetValue(ValueProperty);
|
||||
set => SetValue(ValueProperty, value);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void OnAttached()
|
||||
{
|
||||
if (AssociatedObject != null)
|
||||
AssociatedObject.PointerCaptureLost += OnPointerCaptureLost;
|
||||
base.OnAttached();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void OnDetaching()
|
||||
{
|
||||
if (AssociatedObject != null)
|
||||
AssociatedObject.PointerCaptureLost -= OnPointerCaptureLost;
|
||||
base.OnDetaching();
|
||||
}
|
||||
|
||||
private void OnPointerCaptureLost(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
if (AssociatedObject != null)
|
||||
Value = AssociatedObject.Value;
|
||||
}
|
||||
|
||||
private void OnBindingValueChanged()
|
||||
{
|
||||
if (AssociatedObject != null)
|
||||
AssociatedObject.Value = Value;
|
||||
}
|
||||
}
|
||||
@@ -42,13 +42,13 @@
|
||||
},
|
||||
"Avalonia.Xaml.Behaviors": {
|
||||
"type": "Direct",
|
||||
"requested": "[0.10.13.2, )",
|
||||
"resolved": "0.10.13.2",
|
||||
"contentHash": "sZlq6FFzNNzYmHK+vARWFpxtDY4XUdnU6q6zVIm4l1iQ3/ZXor4SeUnYDdd3lFZtoJ9yc8K2g4X7d/lVEgV9tA==",
|
||||
"requested": "[0.10.13.3, )",
|
||||
"resolved": "0.10.13.3",
|
||||
"contentHash": "XP0wLpGsMKsz9d66CqHj2T8Q+pYYnlO3FXwwX3nPI/PO/YC6RBJwMDye29D+Cy11NuRgfRBvRej6sBxghI+BgA==",
|
||||
"dependencies": {
|
||||
"Avalonia": "0.10.13",
|
||||
"Avalonia.Xaml.Interactions": "0.10.13.2",
|
||||
"Avalonia.Xaml.Interactivity": "0.10.13.2"
|
||||
"Avalonia.Xaml.Interactions": "0.10.13.3",
|
||||
"Avalonia.Xaml.Interactivity": "0.10.13.3"
|
||||
}
|
||||
},
|
||||
"DynamicData": {
|
||||
@@ -217,17 +217,17 @@
|
||||
},
|
||||
"Avalonia.Xaml.Interactions": {
|
||||
"type": "Transitive",
|
||||
"resolved": "0.10.13.2",
|
||||
"contentHash": "bMgr5NtEjJ/qvf+1JD4T4rRt9AbZNnJdYCx5cBfGyXHETbeliTJAt07mqTahcoPY1G2FskF1OSIW5ytljbviLw==",
|
||||
"resolved": "0.10.13.3",
|
||||
"contentHash": "kS21Q3saItFL15/ctDjUAbDoqxt0/fTKBjXtxMyQGKoH1ZKU8YJPNwqGWts2MEGXTe4N7xlx2qHcDJlb0EbSxA==",
|
||||
"dependencies": {
|
||||
"Avalonia": "0.10.13",
|
||||
"Avalonia.Xaml.Interactivity": "0.10.13.2"
|
||||
"Avalonia.Xaml.Interactivity": "0.10.13.3"
|
||||
}
|
||||
},
|
||||
"Avalonia.Xaml.Interactivity": {
|
||||
"type": "Transitive",
|
||||
"resolved": "0.10.13.2",
|
||||
"contentHash": "OIjK5XCsUrBCqog8lxI/DEbubaNQRwy8e8Px4i3dvllomU28EYsJm4XtrPVakY7MC+we825uXY47tsO/benLug==",
|
||||
"resolved": "0.10.13.3",
|
||||
"contentHash": "twYpSqHOsVWoe2uayY7Q0EkDEmah6xkXGE/83jIDvi0ERZ8uvtN65bBDXFNk0fmwdidPb2EHllUgtRrT0m7PuA==",
|
||||
"dependencies": {
|
||||
"Avalonia": "0.10.13"
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user