Skip to content

Commit

Permalink
chore: Re-add removed virtual methods
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinZikmund committed Dec 14, 2022
1 parent 8cab9db commit f799360
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Uno.UI/UI/Xaml/Controls/Popup/Popup.Legacy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ private void OnBasePropertyChanged(DependencyObject sender, DependencyProperty d
get => GetHorizontalOffsetValue();
set => SetHorizontalOffsetValue(value);
}
private void OnHorizontalOffsetChanged(double oldValue, double newValue)
private new void OnHorizontalOffsetChanged(double oldValue, double newValue)
=> base.HorizontalOffset = newValue;

[GeneratedDependencyProperty(DefaultValue = 0.0, LocalCache = false, ChangedCallback = true)]
Expand All @@ -104,7 +104,7 @@ private void OnHorizontalOffsetChanged(double oldValue, double newValue)
set => SetVerticalOffsetValue(value);
}

private void OnVerticalOffsetChanged(double oldValue, double newValue)
private new void OnVerticalOffsetChanged(double oldValue, double newValue)
=> base.VerticalOffset = newValue;

[GeneratedDependencyProperty(DefaultValue = 0.0, LocalCache = false, ChangedCallback = true)]
Expand Down
32 changes: 30 additions & 2 deletions src/Uno.UI/UI/Xaml/Controls/Popup/Popup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,21 @@ public double HorizontalOffset
nameof(HorizontalOffset),
typeof(double),
typeof(Popup),
new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.AffectsMeasure));
new FrameworkPropertyMetadata(
0.0,
FrameworkPropertyMetadataOptions.AffectsMeasure,
propertyChangedCallback: (s, e) => ((Popup)s)?.OnHorizontalOffsetChanged((double)e.OldValue, (double)e.NewValue)
)
);

protected virtual void OnHorizontalOffsetChanged(double oldHorizontalOffset, double newHorizontalOffset)
{
OnHorizontalOffsetChangedPartial(oldHorizontalOffset, newHorizontalOffset);
OnHorizontalOffsetChangedPartialNative(oldHorizontalOffset, newHorizontalOffset);
}

partial void OnHorizontalOffsetChangedPartial(double oldHorizontalOffset, double newHorizontalOffset);
partial void OnHorizontalOffsetChangedPartialNative(double oldHorizontalOffset, double newHorizontalOffset);

/// <summary>
/// Gets or sets the distance between the top of the application window and the top of the popup.
Expand All @@ -224,7 +238,21 @@ public double VerticalOffset
nameof(VerticalOffset),
typeof(double),
typeof(Popup),
new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.AffectsMeasure));
new FrameworkPropertyMetadata(
0.0,
FrameworkPropertyMetadataOptions.AffectsMeasure,
propertyChangedCallback: (s, e) => ((Popup)s)?.OnVerticalOffsetChanged((double)e.OldValue, (double)e.NewValue)
)
);

protected virtual void OnVerticalOffsetChanged(double oldVerticalOffset, double newVerticalOffset)
{
OnVerticalOffsetChangedPartial(oldVerticalOffset, newVerticalOffset);
OnVerticalOffsetChangedPartialNative(oldVerticalOffset, newVerticalOffset);
}

partial void OnVerticalOffsetChangedPartial(double oldVerticalOffset, double newVerticalOffset);
partial void OnVerticalOffsetChangedPartialNative(double oldVerticalOffset, double newVerticalOffset);

/// <summary>
/// Raised when the ActualPlacement property changes.
Expand Down

0 comments on commit f799360

Please sign in to comment.