Skip to content

Instantly share code, notes, and snippets.

@KalinovDmitri
Created March 13, 2017 06:02
Show Gist options
  • Save KalinovDmitri/82c71987c65002751c425c59f1db6a25 to your computer and use it in GitHub Desktop.
Save KalinovDmitri/82c71987c65002751c425c59f1db6a25 to your computer and use it in GitHub Desktop.
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