更新
This commit is contained in:
@@ -137,54 +137,55 @@ public partial class ToastControl : UserControl
|
||||
ownerWidth = SystemParameters.WorkArea.Size.Width * DpiHelper.ScaleX;
|
||||
ownerHeight = SystemParameters.WorkArea.Size.Height * DpiHelper.ScaleY;
|
||||
}
|
||||
popup.HorizontalOffset = (ownerWidth - popupWidth) / 2d;
|
||||
popup.VerticalOffset = toast.OffsetMargin.Top + offset.Top;
|
||||
//switch (toast.Location)
|
||||
//{
|
||||
// case ToastLocation.Center:
|
||||
// popup.HorizontalOffset = (ownerWidth - popupWidth) / 2d;
|
||||
// popup.VerticalOffset = (ownerHeight - popupHeight) / 2d;
|
||||
// break;
|
||||
|
||||
switch (toast.Location)
|
||||
{
|
||||
case ToastLocation.Center:
|
||||
popup.HorizontalOffset = (ownerWidth - popupWidth) / 2d;
|
||||
popup.VerticalOffset = (ownerHeight - popupHeight) / 2d;
|
||||
break;
|
||||
// case ToastLocation.Left:
|
||||
// popup.HorizontalOffset = offset.Left;
|
||||
// popup.VerticalOffset = (ownerHeight - popupHeight) / 2d;
|
||||
// break;
|
||||
|
||||
case ToastLocation.Left:
|
||||
popup.HorizontalOffset = offset.Left;
|
||||
popup.VerticalOffset = (ownerHeight - popupHeight) / 2d;
|
||||
break;
|
||||
// case ToastLocation.Right:
|
||||
// popup.HorizontalOffset = ownerWidth - popupWidth - offset.Right;
|
||||
// popup.VerticalOffset = (ownerHeight - popupHeight) / 2d;
|
||||
// break;
|
||||
|
||||
case ToastLocation.Right:
|
||||
popup.HorizontalOffset = ownerWidth - popupWidth - offset.Right;
|
||||
popup.VerticalOffset = (ownerHeight - popupHeight) / 2d;
|
||||
break;
|
||||
// case ToastLocation.TopLeft:
|
||||
// popup.HorizontalOffset = offset.Left;
|
||||
// popup.VerticalOffset = toast.OffsetMargin.Top + offset.Top;
|
||||
// break;
|
||||
|
||||
case ToastLocation.TopLeft:
|
||||
popup.HorizontalOffset = offset.Left;
|
||||
popup.VerticalOffset = toast.OffsetMargin.Top + offset.Top;
|
||||
break;
|
||||
// case ToastLocation.TopCenter:
|
||||
// popup.HorizontalOffset = (ownerWidth - popupWidth) / 2d;
|
||||
// popup.VerticalOffset = toast.OffsetMargin.Top + offset.Top;
|
||||
// break;
|
||||
|
||||
case ToastLocation.TopCenter:
|
||||
popup.HorizontalOffset = (ownerWidth - popupWidth) / 2d;
|
||||
popup.VerticalOffset = toast.OffsetMargin.Top + offset.Top;
|
||||
break;
|
||||
// case ToastLocation.TopRight:
|
||||
// popup.HorizontalOffset = ownerWidth - popupWidth - offset.Right;
|
||||
// popup.VerticalOffset = toast.OffsetMargin.Top + offset.Top;
|
||||
// break;
|
||||
|
||||
case ToastLocation.TopRight:
|
||||
popup.HorizontalOffset = ownerWidth - popupWidth - offset.Right;
|
||||
popup.VerticalOffset = toast.OffsetMargin.Top + offset.Top;
|
||||
break;
|
||||
// case ToastLocation.BottomLeft:
|
||||
// popup.HorizontalOffset = offset.Left;
|
||||
// popup.VerticalOffset = ownerHeight - popupHeight - offset.Bottom;
|
||||
// break;
|
||||
|
||||
case ToastLocation.BottomLeft:
|
||||
popup.HorizontalOffset = offset.Left;
|
||||
popup.VerticalOffset = ownerHeight - popupHeight - offset.Bottom;
|
||||
break;
|
||||
// case ToastLocation.BottomCenter:
|
||||
// popup.HorizontalOffset = (ownerWidth - popupWidth) / 2d;
|
||||
// popup.VerticalOffset = ownerHeight - popupHeight - offset.Bottom;
|
||||
// break;
|
||||
|
||||
case ToastLocation.BottomCenter:
|
||||
popup.HorizontalOffset = (ownerWidth - popupWidth) / 2d;
|
||||
popup.VerticalOffset = ownerHeight - popupHeight - offset.Bottom;
|
||||
break;
|
||||
|
||||
case ToastLocation.BottomRight:
|
||||
popup.HorizontalOffset = ownerWidth - popupWidth - offset.Right;
|
||||
popup.VerticalOffset = ownerHeight - popupHeight - offset.Bottom;
|
||||
break;
|
||||
}
|
||||
// case ToastLocation.BottomRight:
|
||||
// popup.HorizontalOffset = ownerWidth - popupWidth - offset.Right;
|
||||
// popup.VerticalOffset = ownerHeight - popupHeight - offset.Bottom;
|
||||
// break;
|
||||
//}
|
||||
}
|
||||
|
||||
public void Close()
|
||||
|
||||
Reference in New Issue
Block a user