misc: add AcceptableKeys demo.
This commit is contained in:
@@ -5,11 +5,16 @@
|
|||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:u="https://irihi.tech/ursa"
|
xmlns:u="https://irihi.tech/ursa"
|
||||||
|
xmlns:vm="clr-namespace:Ursa.Demo.ViewModels;assembly=Ursa.Demo"
|
||||||
d:DesignHeight="450"
|
d:DesignHeight="450"
|
||||||
d:DesignWidth="800"
|
d:DesignWidth="800"
|
||||||
|
x:CompileBindings="True"
|
||||||
|
x:DataType="vm:KeyGestureInputDemoViewModel"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
<StackPanel Margin="20">
|
<StackPanel Margin="20">
|
||||||
|
<TextBlock Text="Accept all keys" />
|
||||||
<u:KeyGestureInput HorizontalAlignment="Left" />
|
<u:KeyGestureInput HorizontalAlignment="Left" />
|
||||||
<u:KeyGestureInput HorizontalAlignment="Left" />
|
<TextBlock Text="Accept only A,B and C" />
|
||||||
|
<u:KeyGestureInput HorizontalAlignment="Left" AcceptableKeys="{Binding AcceptableKeys}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
@@ -1,8 +1,13 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using Avalonia.Input;
|
||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
|
||||||
namespace Ursa.Demo.ViewModels;
|
namespace Ursa.Demo.ViewModels;
|
||||||
|
|
||||||
public class KeyGestureInputDemoViewModel: ObservableObject
|
public class KeyGestureInputDemoViewModel: ObservableObject
|
||||||
{
|
{
|
||||||
|
public List<Key> AcceptableKeys { get; set; } = new List<Key>()
|
||||||
|
{
|
||||||
|
Key.A, Key.B, Key.C,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user