C# and WPF tutorial files

This commit is contained in:
Unknown
2017-05-29 21:01:07 +01:00
parent dfdd754362
commit 1cb838df3a
107 changed files with 5760 additions and 0 deletions

View File

@ -0,0 +1,17 @@
using PropertyChanged;
using System.ComponentModel;
namespace WpfTreeView
{
/// <summary>
/// A base view model that fires Property Changed events as needed
/// </summary>
[ImplementPropertyChanged]
public class BaseViewModel : INotifyPropertyChanged
{
/// <summary>
/// The event that is fired when any child property changes its value
/// </summary>
public event PropertyChangedEventHandler PropertyChanged = (sender, e) => { };
}
}

View File

@ -0,0 +1,64 @@
using System;
using System.Windows.Input;
namespace WpfTreeView
{
/// <summary>
/// A basic command that runs an Action
/// </summary>
public class RelayCommand : ICommand
{
#region Private Members
/// <summary>
/// The action to run
/// </summary>
private Action mAction;
#endregion
#region Public Events
/// <summary>
/// The event thats fired when the <see cref="CanExecute(object)"/> value has changed
/// </summary>
public event EventHandler CanExecuteChanged = (sender, e) => { };
#endregion
#region Constructor
/// <summary>
/// Default constructor
/// </summary>
public RelayCommand(Action action)
{
mAction = action;
}
#endregion
#region Command Methods
/// <summary>
/// A relay command can always execute
/// </summary>
/// <param name="parameter"></param>
/// <returns></returns>
public bool CanExecute(object parameter)
{
return true;
}
/// <summary>
/// Executes the commands Action
/// </summary>
/// <param name="parameter"></param>
public void Execute(object parameter)
{
mAction();
}
#endregion
}
}