Created
March 13, 2017 06:02
-
-
Save KalinovDmitri/82c71987c65002751c425c59f1db6a25 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Runtime.CompilerServices; | |
using System.Windows.Input; | |
namespace CodeExamples.Wpf.Interactivity | |
{ | |
public class MainWindowViewModel : ViewModelBase | |
{ | |
#region Fields and properties | |
private string SelectedItem; | |
public string[] AvailableComboBoxValues | |
{ | |
get { return new[] { "E", "W" }; } | |
} | |
public string SelectedComboBoxItem | |
{ | |
get { return SelectedItem; } | |
set | |
{ | |
SelectedItem = value; | |
RaisePropertyChanged(); | |
} | |
} | |
#endregion | |
#region Constructors | |
public MainWindowViewModel() : base() { } | |
#endregion | |
#region ViewModelBase methods overriding | |
protected override void RaisePropertyChanged([CallerMemberName] string propertyName = "") | |
{ | |
base.RaisePropertyChanged(propertyName); | |
if (string.Equals(propertyName, nameof(SelectedComboBoxItem), StringComparison.Ordinal)) | |
{ | |
// do something you need | |
} | |
} | |
#endregion | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment