Questions tagged [eventtocommand]
61 questions
37
votes
3 answers
MVVM Light: Adding EventToCommand in XAML without Blend, easier way or snippet?
Can anyone tell me what the actual syntax is for EventToCommand class. From what I believe is that EventToCommand class works with Silverlight / WPF and WP7, hence I think its a better choice to go down.
From what I believe, I can add any click…

Martin
- 23,844
- 55
- 201
- 327
30
votes
2 answers
When to use events over commands in WPF?
Hi i have recently looked into WPF and started learning about Events and Commands. I typically use Commands on Button clicks which causes a method to Run in my "view model".
Is it possible to make the Button react to any other events like the…

CAA
- 355
- 3
- 5
9
votes
1 answer
MVVM-Light => Pass Command Parameter AND EventArgs to Command
Using MVVM-Light Toolkit in Silverlight 5, i am trying to find a way to pass Command Parameters AND EventArgs both to ViewModel in an Event-To-Command behavior.
I did find a post suggesting Passing EventArgs as Command Parameters but in my case i…

Thr3e
- 358
- 1
- 6
- 22
8
votes
1 answer
MvvmLight EventToCommand on a TreeView throwing NullReferenceException
First, the code:

Josh Smeaton
- 47,939
- 24
- 129
- 164
7
votes
0 answers
EventToCommand for Loaded event not working as expected if Window.SizeToContent = WidthAndHeight
I find out that the EventToCommand for the Loaded-event is not working as expected if the Window.SizeToContent attribute is set to WidthAndHeight.
The Loaded-event seems to be fired correctly, but the EventToCommand.Command property is bound AFTER…

Sebastian
- 73
- 5
7
votes
2 answers
Attaching Command to ScrollViewer.ScrollChanged of ListView
The WPF ListView class can be set up to automatically handle scrolling without an external ScrollViewer and it's possible to register an event handler for the control's internal scrollbar by writing XAML like such:

ISens
- 191
- 2
- 11
5
votes
3 answers
Windows Phone 8.1 - MVVMLight - Why is EventToCommad not working?
I am not able to use EventToCommand in my Windows Phone 8.1…

DominikP
- 151
- 1
- 10
4
votes
1 answer
EventToCommand with attached event
I use on attached event Validation.Error of the TextBox.
Validation.Error
I want to bind it to EventToCommand.
Normally it does not work:

Hodaya Shalom
- 4,327
- 12
- 57
- 111
4
votes
1 answer
Binding CommandParameter on ItemsControl Tap event
I'm using an ItemsControl, and I want to identify which item was selected on the Tap command. My xaml is defined here:
…

earthling
- 5,084
- 9
- 46
- 90
3
votes
1 answer
.Net Maui EventToCommand for unfocus event for Entry throws System.InvalidCastException
Am building a new App in .Net Maui using VS 2022 Preview.
I am using CommunityToolkit.Mvvm
I have an entry field. When this field loses focus, I want to trigger a command.
My xaml is :

MethodToChaos
- 335
- 2
- 17
3
votes
1 answer
Pass event argument to command with Microsoft.Toolkit.Mvvm and Microsoft.Xaml.Behaviors.Wpf
I try to implement the MVVM pattern for this sample (just simple paging part) with Microsoft.Toolkit.Mvvm unfortunately, I failed :( because I'm so noob in WPF also MVVM :))
the primary problem is how can I pass an argument of an event to command…

threefx
- 81
- 1
- 8
3
votes
1 answer
Is there a way to use the EventToCommand of the MVVMLight in the Microsoft.Xaml.Behaviors.Wpf?
I have used System.Windows.Interactivity.WPF library with MVVM Light.
I deleted System.Windows.Interactivity.WPF library because it's publishing date is old. And I installed Microsoft.Xaml.Behaviors.Wpf library and updated related to content.
The…

jjw
- 282
- 3
- 20
3
votes
0 answers
Xamarin Forms - EventToCommanBehavior do not bind command
I attempted to use EventToCommandBehavior like in below…

Piotr Kwiatkowski
- 129
- 2
- 10
3
votes
1 answer
EventToCommand missing on MVVM Light
This helpful class seems to be gone from the latest MVVM Light build, any idea why or how to work around it?
I'm using MvvmLightLibs.5.0.1.0, was definitely there on MvvmLightLibs.4.1.27.0. So this question is not related with one EventToCommand…

D.Rosado
- 5,634
- 3
- 36
- 56
3
votes
2 answers
How to use an EventToCommand with an editable Combobox to bind TextBoxBase.TextChanged with a command?
I have an editable ComboBox.
…

Fumidu
- 288
- 4
- 14