canton7 / Stylet

A very lightweight but powerful ViewModel-First MVVM framework for WPF for .NET Framework and .NET Core, inspired by Caliburn.Micro.
MIT License
988 stars 143 forks source link

How can i use s:Action as event handler? #156

Closed wanglehui closed 3 years ago

wanglehui commented 3 years ago

Hi,canton7

When i bind control event handler to s:Action XX funtion, how can set CommnadParameter to event parameter? Some thing like EventToCommand Behavior.

canton7 commented 3 years ago

When you're using an event with s:Action, there is no concept of CommandParameter: there's no way to pass one in the XAML, and no way of getting one back in the C#. I recommend binding whatever property you're interested in to a property on your ViewModel.

canton7 commented 3 years ago

Closing as no response