Skip to content
This repository has been archived by the owner on Sep 4, 2024. It is now read-only.

Commit

Permalink
[WPF] Removed Margin, Borderds if the Popover.Padding == 0.
Browse files Browse the repository at this point in the history
  • Loading branch information
viniciusjarina committed May 14, 2019
1 parent 436cb01 commit 1576f33
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions Xwt.WPF/Xwt.WPFBackend/PopoverBackend.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,23 @@ public FrameworkElement GetPopupRoot ()
} while (true);
}

void SetupBorderMargin ()
{
if (Frontend.Padding != 0)
return;

Border.Padding = new Thickness (1, 1, 1, 1);
Border.BorderThickness = new Thickness (1);
Border.Margin = new Thickness (1);
}

public PopoverBackend ()
{
Border = new System.Windows.Controls.Border {
Padding = new Thickness (15, 10, 15, 15),
BorderThickness = new Thickness (1),
Margin = new System.Windows.Thickness (10),
Effect = new System.Windows.Media.Effects.DropShadowEffect () {
Padding = new Thickness (15, 10, 15, 15),
BorderThickness = new Thickness (1),
Margin = new Thickness (10),
Effect = new System.Windows.Media.Effects.DropShadowEffect () {
Color = Colors.Black,
Direction = 270,
BlurRadius = 15,
Expand Down Expand Up @@ -132,6 +142,7 @@ public void Initialize (IPopoverEventSink sink)
public void Show (Xwt.Popover.Position orientation, Xwt.Widget reference, Xwt.Rectangle positionRect, Widget child)
{
ActualPosition = orientation;
SetupBorderMargin ();
Border.Child = (System.Windows.FrameworkElement)Context.Toolkit.GetNativeWidget (child);
NativeWidget.CustomPopupPlacementCallback = (popupSize, targetSize, offset) => {
System.Windows.Point location;
Expand Down

0 comments on commit 1576f33

Please sign in to comment.