-
Notifications
You must be signed in to change notification settings - Fork 0
How To : Curanza and FrameworkElement
You can bind a RelayCommand when a FrameworkElement is loaded on the UI. You can pass any custom parameter to the command.
In the example below, the command LoadedCommand is executed when the Grid is loaded from the UWP engine.
<Grid DataContext="{StaticResource featuresVm}" curanza:FrameworkElementHelper.LoadedCommand="{Binding LoadedCommand}" curanza:FrameworkElementHelper.LoadedCommandParameter="1">
You can bind a RelayCommand when the user double-tap any FrameworkElement on the UI. You can pass any custom parameter to the command.
In the example below, the command EditItemCommand is executed when the user performs a double-tap on the TextBlock.
<TextBlock curanza:FrameworkElementHelper.DoubleTappedCommand="{Binding EditItemCommand}" curanza:FrameworkElementHelper.DoubleTappedCommandParameter="{Binding}">
You can bind a RelayCommand when the user press any key and the associated FrameworkElement has focus. You can pass any custom parameter to the command. Is no key is specified, Enter key is used.
See the example below. The command ConfirmItemCommand is executed when the user press Enter key and the TextBox has focus.
<TextBox Text="{Binding Description}" curanza:FrameworkElementHelper.KeyDownCommand="{Binding ConfirmItemCommand}" curanza:FrameworkElementHelper.KeyDownCommandParameter="{Binding}" />
You can specify a different key using the Key property (F4 in the example).
<TextBox Text="{Binding Description}" curanza:FrameworkElementHelper.KeyDownCommand="{Binding ConfirmItemCommand}" curanza:FrameworkElementHelper.KeyDownCommandParameter="{Binding}" curanza:FrameworkElementHelper.Key="F4" />