MouseBinding

De Banane Atomic
(Redirigé depuis Mousebinding)
Aller à la navigationAller à la recherche

Links

Mouse binding

MyView.xaml
<TextBlock Text="{Binding Name}">
    <TextBlock.InputBindings>
        <MouseBinding MouseAction="LeftDoubleClick"
                      Command="{Binding EditCommand}"
                      CommandParameter="{Binding}" />
    </TextBlock.InputBindings>
</TextBlock>
MyViewModel.cs
public ICommand EditCommand { get; }

public MyViewModel()
{
    EditCommand = new DelegateCommand<Item>(Edit);
}

private void Edit(Item item)
{
}