« MouseBinding » : différence entre les versions
De Banane Atomic
Aller à la navigationAller à la recherche
(Page redirigée vers InputBindings) Balise : Nouvelle redirection |
m (Nicolas a déplacé la page Mousebinding vers MouseBinding) |
||
(2 versions intermédiaires par le même utilisateur non affichées) | |||
Ligne 1 : | Ligne 1 : | ||
[[Category:WPF]] | |||
= Links = | |||
* [http://www.blackwasp.co.uk/WPFMouseBindings.aspx Mouse binding] | |||
= Mouse binding = | |||
<filebox fn='MyView.xaml'> | |||
<TextBlock Text="{Binding Name}"> | |||
<TextBlock.InputBindings> | |||
<MouseBinding MouseAction="LeftDoubleClick" | |||
Command="{Binding EditCommand}" | |||
CommandParameter="{Binding}" /> | |||
</TextBlock.InputBindings> | |||
</TextBlock> | |||
</filebox> | |||
<filebox fn='MyViewModel.cs'> | |||
public ICommand EditCommand { get; } | |||
public MyViewModel() | |||
{ | |||
EditCommand = new DelegateCommand<Item>(Edit); | |||
} | |||
private void Edit(Item item) | |||
{ | |||
} | |||
</filebox> |
Dernière version du 20 octobre 2021 à 08:40
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) { } |