fix: close #1461
This commit is contained in:
1 parent
ef5ab72301
commit
8e1e8263f7
4 files changed
+221
-5
No files matched your search
@@ -1,9 +1,11 @@
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Markup;
|
||||
using HandyControl.Data;
|
||||
using HandyControl.Input;
|
||||
using HandyControl.Interactivity;
|
||||
|
||||
namespace HandyControl.Controls;
|
||||
@@ -19,8 +21,6 @@ public class ToggleBlock : Control
|
||||
public static readonly DependencyProperty IndeterminateContentProperty = DependencyProperty.Register(nameof(IndeterminateContent), typeof(object), typeof(ToggleBlock), new PropertyMetadata(default(object)));
|
||||
public static readonly DependencyProperty ToggleGestureProperty = DependencyProperty.Register(nameof(ToggleGesture), typeof(MouseGesture), typeof(ToggleBlock), new UIPropertyMetadata(new MouseGesture(MouseAction.None), OnToggleGestureChanged));
|
||||
|
||||
private MouseBinding _toggleBinding;
|
||||
|
||||
[Category("Appearance")]
|
||||
[TypeConverter(typeof(NullableBoolConverter))]
|
||||
[Localizability(LocalizationCategory.None, Readability = Readability.Unreadable)]
|
||||
@@ -75,9 +75,12 @@ public class ToggleBlock : Control
|
||||
|
||||
private void OnToggleGestureChanged(MouseGesture newValue)
|
||||
{
|
||||
InputBindings.Remove(_toggleBinding);
|
||||
_toggleBinding = new MouseBinding(ControlCommands.Toggle, newValue);
|
||||
InputBindings.Add(_toggleBinding);
|
||||
foreach (var binding in InputBindings.OfType<SimpleMouseBinding>().ToList())
|
||||
{
|
||||
InputBindings.Remove(binding);
|
||||
}
|
||||
|
||||
InputBindings.Add(new SimpleMouseBinding(ControlCommands.Toggle, newValue));
|
||||
}
|
||||
|
||||
private void OnToggled(object sender, ExecutedRoutedEventArgs e)
|
||||
|
||||
Reference in new issue
Block a user