Is it possible to fire a command to notify the window is loaded. Also, I'm not using any MVVM frameworks (Frameworks in the sense, Caliburn, Onxy, MVVM Toolkit etc.,)
This is much easier to do now. Simply include the following namespace:
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
And leverage it like this:
<i:Interaction.Triggers>
<i:EventTrigger EventName="Loaded">
<i:InvokeCommandAction Command="{Binding CommandInViewModel}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
private void Window_Loaded(object sender, RoutedEventArgs e)
{
ApplicationCommands.New.Execute(null, targetElement);
// or this.CommandBindings[0].Command.Execute(null);
}
and xaml
Loaded="Window_Loaded"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With