Introduction Ivan Krivyakov suggested an Observable<T>, when declared as property in a class, and the property is changed, it will raise a PropertyChanged event automatically, thus any WPF control that link to the Observable<T> will update the value. I found it useful because developer no longer need to write getter, setter code and notifyChange code [...]
Archives for CodeSnippet
SimpleRoutedCommand
Updated : 07-07-10 Added instance specific register methods. Introduction Sacha Barber’s Cinch framework provides SimpleCommand, which allows setting ICommand‘s CanExecute() and Execute() method in one place, using lamba statement, it helps makes my code cleaner and thus easier to maintain. To reduce translation required I used the static RoutedUICommand library provided by WPF, like ApplicationCommands, [...]
Re: Once more about macros in C# (version 2)
This is a respond for Ivan Krivyakov’s Once more about macros in C#, feature an Observable that can “construct itself” and able to notify changes. public class ModelBase { private Dictionary<string, object> variableDic = new Dictionary<string, object>(); protected Observable<T> getVar<T>(string name) //GetVariable { if (!variableDic.ContainsKey(name)) variableDic.Add(name, new Observable<T>()); return (Observable<T>)variableDic[name]; } } public class Person [...]
Posts