I need a few answers here as can't seem to find much online which are answering my questions. From my understanding, to follow the MVVM workflow when coding an WPF application, the data, logic and user input needs to be separate.
So, to follow that logic i'm guessing I would create a folder called something like Classes, then create a class file called Commands.cs.
Commands.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Duplicate_Deleter.Classes
{
class WindowCommands
{
}
class DatabaseCommands
{
}
class OtherCommands
{
}
}
Then I have got to reference this class file within my XAML so my user input window knows what the command is right?
<Window
xmlns:local="clr-namespace:Classes.Commands">
</Window>
Then of course I would setup the commands so it knows which method to use for each state, e.g:
<Window.CommandBindings>
<CommandBinding Command="WindowCommands.WindowClose" Executed="CloseWindow_Executed" CanExecute="CloseWindow_CanExecute" />
<CommandBinding Command="WindowMinimize" Executed="CloseWindow_Executed" CanExecute="CloseWindow_CanExecute" />
</Window.CommandBindings>
Am I thinking right here? Could someone clarify this or explain how to do what i'm attempting if i'm doing it wrong?