/// <summary> /// 弹出 /// </summary> /// <param name="popupItem">窗体实例</param> /// <param name="rect">矩形区域</param> /// <returns>Task</returns> private async Task ShowPopup(PopupItem popupItem, Rectangle rect) { //重绘 _rect = rect; _canvasView.InvalidateSurface(); // 响应不传递 _absoluteLayout.InputTransparent = false; // 画布可见 _canvasView.IsVisible = true; // 获取弹窗的view对象 var popup = ((AbsoluteLayout)Children[1]).Children.First(c => c == popupItem.Content); // 向内偏移2 var localRect = new Rectangle(rect.X + 2, rect.Y + 2, rect.Width - 4, rect.Height - 4); // 设置弹窗位置 popup.SetValue(AbsoluteLayout.LayoutBoundsProperty, localRect); // 弹窗对象可见 //popupItem.IsShown = true; // 弹窗view可见 popup.IsVisible = true; // 显示动画 await Task.WhenAll( popup.FadeTo(1, 200, Easing.CubicInOut), _canvasView.FadeTo(1, 200, Easing.CubicInOut) ).ConfigureAwait(false); }