mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Added Hotkey Display Control
This commit is contained in:
parent
95ebac27b9
commit
a62b67e0b7
3 changed files with 85 additions and 5 deletions
|
|
@ -9,7 +9,62 @@
|
|||
d:DesignWidth="800"
|
||||
mc:Ignorable="d">
|
||||
<Grid>
|
||||
<Button
|
||||
<ItemsControl x:Name="KeysControl">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
</Grid>
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Button Content="{Binding num}">
|
||||
<Button.InputBindings>
|
||||
<MouseBinding
|
||||
Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.LeftClick}"
|
||||
CommandParameter="{Binding num}"
|
||||
Gesture="LeftClick" />
|
||||
<MouseBinding
|
||||
Command="{Binding RightClick}"
|
||||
CommandParameter="{Binding num}"
|
||||
Gesture="RightClick" />
|
||||
</Button.InputBindings>
|
||||
</Button>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
<ItemsControl.ItemContainerStyle>
|
||||
<Style TargetType="ContentPresenter">
|
||||
<Setter Property="Grid.Row" Value="{Binding row}" />
|
||||
<Setter Property="Grid.Column" Value="{Binding col}" />
|
||||
</Style>
|
||||
</ItemsControl.ItemContainerStyle>
|
||||
|
||||
</ItemsControl>
|
||||
<!--<Button
|
||||
Grid.Column="1"
|
||||
Width="Auto"
|
||||
FontSize="13"
|
||||
|
|
@ -29,7 +84,7 @@
|
|||
</ControlTemplate>
|
||||
</Button.Template>
|
||||
<Button.Content>
|
||||
<ItemsControl ItemsSource="{Binding Path=KeysToDisplay}">
|
||||
<ItemsControl x:Name="KeysControl">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Orientation="Horizontal" />
|
||||
|
|
@ -49,6 +104,6 @@
|
|||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</Button.Content>
|
||||
</Button>
|
||||
</Button>-->
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
|
@ -13,6 +16,9 @@ using System.Windows.Media;
|
|||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using Windows.Media.Capture.Frames;
|
||||
using static System.Windows.Forms.LinkLabel;
|
||||
using static ABI.System.Collections.Generic.IReadOnlyDictionary_Delegates;
|
||||
|
||||
namespace Flow.Launcher.Resources.Controls
|
||||
{
|
||||
|
|
@ -21,6 +27,9 @@ namespace Flow.Launcher.Resources.Controls
|
|||
public HotkeyDisplay()
|
||||
{
|
||||
InitializeComponent();
|
||||
//List<string> stringList =e.NewValue.Split('+').ToList();
|
||||
KeysControl.ItemsSource = Values;
|
||||
|
||||
}
|
||||
|
||||
public string Keys
|
||||
|
|
@ -29,6 +38,20 @@ namespace Flow.Launcher.Resources.Controls
|
|||
set { SetValue(KeysValueProperty, value); }
|
||||
}
|
||||
public static readonly DependencyProperty KeysValueProperty =
|
||||
DependencyProperty.Register("Keys", typeof(string), typeof(HotkeyDisplay), new PropertyMetadata(string.Empty));
|
||||
DependencyProperty.Register("Keys", typeof(string), typeof(HotkeyDisplay), new PropertyMetadata(string.Empty, valueChanged));
|
||||
|
||||
private static void valueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var control = d as UserControl;
|
||||
if (null == control) return; // This should not be possible
|
||||
|
||||
var newValue = e.NewValue as string;
|
||||
if (null == newValue) return;
|
||||
|
||||
//String[] Values = newValue.Split('+');
|
||||
//Debug.WriteLine(Values[0]);
|
||||
}
|
||||
|
||||
public ObservableCollection<string> Values { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2729,7 +2729,9 @@
|
|||
Title="{DynamicResource flowlauncherHotkey}"
|
||||
Icon=""
|
||||
Sub="{DynamicResource flowlauncherHotkeyToolTip}"
|
||||
Type="Inside" />
|
||||
Type="Inside">
|
||||
<cc:HotkeyDisplay Keys="Ctrl+F4" />
|
||||
</cc:Card>
|
||||
</StackPanel>
|
||||
</cc:ExCard>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue