Skip to content

Commit

Permalink
chore: simplify code
Browse files Browse the repository at this point in the history
  • Loading branch information
dansiegel committed Feb 25, 2024
1 parent e7a839f commit 08e27a9
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/Wpf/Prism.Wpf/Common/ObservableObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,14 @@ public partial class ObservableObject<T> : FrameworkElement, INotifyPropertyChan
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods")]
public T Value
{
get { return (T)this.GetValue(ValueProperty); }
set { this.SetValue(ValueProperty, value); }
get => (T)GetValue(ValueProperty);
set => SetValue(ValueProperty, value);
}

private static void ValueChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
ObservableObject<T> thisInstance = ((ObservableObject<T>)d);
PropertyChangedEventHandler eventHandler = thisInstance.PropertyChanged;
if (eventHandler != null)
{
eventHandler(thisInstance, new PropertyChangedEventArgs("Value"));
}
thisInstance.PropertyChanged?.Invoke(thisInstance, new PropertyChangedEventArgs(nameof(Value)));
}
}
}

0 comments on commit 08e27a9

Please sign in to comment.