Advertisement
kneefer

Dependency Property

Jun 14th, 2016
347
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.57 KB | None | 0 0
  1. private static DependencyProperty RegisterProperty<T>(
  2.     Expression<Func<BindableListBox, T>> associatedProperty,
  3.     T defaultValue,
  4.     Action<BindableListBox> valueChangedAction = null)
  5. {
  6.     return DependencyProperty.Register(
  7.         GetPropertyName(associatedProperty),
  8.         typeof(T),
  9.         typeof(BindableListBox),
  10.         new PropertyMetadata(defaultValue, (s, e) =>
  11.         {
  12.             var sender = s as BindableListBox;
  13.             if (sender != null)
  14.             {
  15.                 valueChangedAction?.Invoke(sender);
  16.             }
  17.         }));
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement