OK, I try to avoid using commands because they always manage to confuse me, but I am in a new project and I am trying to archive it correctly, without code in my view. Basically, all I'm trying to do right now is to connect a button that launches a command that does some things on my presentation model, and for some reason something so simple still causes me problems. I think I'm close, but I canβt get there. Here is what I have right now.
<Window.Resources>
<RoutedUICommand x:Key="GetMusic" />
</Window.Resources>
<Window.DataContext>
<core:ViewMain />
</Window.DataContext>
<Window.CommandBindings>
<CommandBinding Command="{StaticResource GetMusic}" Executed="GetMusicExecuted"/>
</Window.CommandBindings>
And the view model has almost nothing right now
public class ViewMain
{
public MusicCollection Music { get; set; }
private void GetMusicExecuted(object sender, ExecutedRoutedEventArgs e)
{
}
}
, , , , execute , . , , ? , , .