Skip to content

Instantly share code, notes, and snippets.

@cmorgado
cmorgado / CommandOnEnterPress.cs
Created September 26, 2014 22:25
Universal App Behavior: press enter on texbox and execute your command
/// <summary>
/// <Interactivity:Interaction.Behaviors>
/// <MoreBehaviors:CommandOnEnterPress Command="{Binding DoYourCommand}" />
/// </Interactivity:Interaction.Behaviors>
/// </summary>
[Microsoft.Xaml.Interactivity.TypeConstraint(typeof(TextBox))]
class CommandOnEnterPress : DependencyObject, IBehavior
{
[Microsoft.Xaml.Interactivity.CustomPropertyValueEditor(Microsoft.Xaml.Interactivity.CustomPropertyValueEditor.PropertyBinding)]