MvvmLight EventToCommand weird behavior

I am trying to use EventToCommand in my XAML. Here is an example of this:

<i:Interaction.Triggers>
    <i:EventTrigger EventName="Loaded">
        <cmd:EventToCommand Command="{Binding StartCommand, Mode=OneWay}" />
    </i:EventTrigger>
    <i:EventTrigger EventName="Unloaded">
        <cmd:EventToCommand Command="{Binding StopCommand, Mode=OneWay}" />
    </i:EventTrigger>
</i:Interaction.Triggers>

When I changed WindowStyle to None, it stops working. I need to change the code by removing the “Interaction.Triggers” part from XAMLand and add to the code below:

private void Window_Loaded(object sender, RoutedEventArgs e)
{
    _viewModel.StartCommand.Execute(null);
}

Then it will work again.

Is this a MVVM-Light bug or is I using EnevtToCommand incorrectly? (I am using MvvmLight version 3.0)

+3
source share

Source: https://habr.com/ru/post/1796274/


All Articles