I have a basic WPF / Silverlight user control code that includes the label that I want to set for the value from the code that uses the control. Is there a way to simplify the requirements for defining dependency properties and related events? It seems very noisy for what seems like a simple coding task (property, method and related wiring).
private static DependencyProperty CountProperty; public MyWpfUserControl() { InitializeComponent(); PropertyChangedCallback countChangedCallback = CountChanged; var metaData = new PropertyMetadata(countChangedCallback); CountProperty = DependencyProperty.Register("Count", typeof (int), typeof (MyWpfUserControl), metaData); } public int ItemsCount { get { return (int) GetValue(CountProperty); } set { SetValue(CountProperty, value); } } private void CountChanged(DependencyObject property, DependencyPropertyChangedEventArgs args) {
source share