mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Split Key to display
This commit is contained in:
parent
a62b67e0b7
commit
66125fce2c
1 changed files with 15 additions and 6 deletions
|
|
@ -28,8 +28,8 @@ namespace Flow.Launcher.Resources.Controls
|
|||
{
|
||||
InitializeComponent();
|
||||
//List<string> stringList =e.NewValue.Split('+').ToList();
|
||||
Values = new ObservableCollection<string>();
|
||||
KeysControl.ItemsSource = Values;
|
||||
|
||||
}
|
||||
|
||||
public string Keys
|
||||
|
|
@ -37,10 +37,13 @@ namespace Flow.Launcher.Resources.Controls
|
|||
get { return (string)GetValue(KeysValueProperty); }
|
||||
set { SetValue(KeysValueProperty, value); }
|
||||
}
|
||||
public static readonly DependencyProperty KeysValueProperty =
|
||||
DependencyProperty.Register("Keys", typeof(string), typeof(HotkeyDisplay), new PropertyMetadata(string.Empty, valueChanged));
|
||||
|
||||
private static void valueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
public static readonly DependencyProperty KeysValueProperty =
|
||||
DependencyProperty.Register("Keys", typeof(string), typeof(HotkeyDisplay),
|
||||
new PropertyMetadata(string.Empty, keyChanged));
|
||||
|
||||
|
||||
private static void keyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var control = d as UserControl;
|
||||
if (null == control) return; // This should not be possible
|
||||
|
|
@ -48,8 +51,14 @@ namespace Flow.Launcher.Resources.Controls
|
|||
var newValue = e.NewValue as string;
|
||||
if (null == newValue) return;
|
||||
|
||||
//String[] Values = newValue.Split('+');
|
||||
//Debug.WriteLine(Values[0]);
|
||||
if (d is not HotkeyDisplay hotkeyDisplay)
|
||||
return;
|
||||
|
||||
hotkeyDisplay.Values.Clear();
|
||||
foreach (var key in newValue.Split('+'))
|
||||
{
|
||||
hotkeyDisplay.Values.Add(key);
|
||||
}
|
||||
}
|
||||
|
||||
public ObservableCollection<string> Values { get; set; }
|
||||
|
|
|
|||
Loading…
Reference in a new issue