Hello anonymous user-4673 ,
Please try to copy this EventToCommandBehavior class and BehaviorBase
class to your project.
namespace QuestionAndAnswer.Demo.Behaviors
{
public class EventToCommandBehavior : BehaviorBase<VisualElement>
{...}
}
Then you can use it on your DemoPage
, it works on my side, the EventArgs
object won't be null in OnButtonTapped
method of DemoPageViewModel
.
<ContentPage
...
xmlns:behavior ="clr-namespace:QuestionAndAnswer.Demo.Behaviors"
...>
<StackLayout VerticalOptions="CenterAndExpand">
...
<demo:DemoUserControl
...>
<demo:DemoUserControl.Behaviors>
<behavior:EventToCommandBehavior Command="{Binding OnButtonTappedCommand}" EventName="OnPasswordButtonTapped" />
</demo:DemoUserControl.Behaviors>
</demo:DemoUserControl>
...
</ContentPage>
I checked your sample, you are using CommunityToolkit, it is not supported on Q&A, you can report this at https://github.com/CommunityToolkit/Maui.
Best Regards,
Wenyan Zhang
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.