Example #1
0
        void AssociatedObject_MouseRightButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            //获得canvas
            if (bd == null)
            {
                //bd = ((this.AssociatedObject as FrameworkElement).Parent as FrameworkElement).Parent as Border;
                dl = (this.AssociatedObject as FrameworkElement).GetLogicalAncestor <AyLayer>();
                if (dl == null)
                {
                    dl = (this.AssociatedObject as FrameworkElement).GetVisualAncestor <AyLayer>();
                }

                if (dl != null)
                {
                    bd = (dl.Content as Grid).FindChild("body", typeof(Border)) as Border;
                }
                (this.AssociatedObject as FrameworkElement).Cursor = Cursors.SizeAll;
                //canvas.SizeChanged += canvas_SizeChanged;
            }
            if (dl.DragTitleBarStart != null)
            {
                dl.DragTitleBarStart();
            }
            isDragging  = true;
            mouseOffset = e.GetPosition(this.bd);
            tempHeight  = (double)this.bd.GetValue(FrameworkElement.ActualHeightProperty);
            tempWidth   = (double)this.bd.GetValue(FrameworkElement.ActualWidthProperty);
            this.AssociatedObject.CaptureMouse();
        }
 /// <summary>
 /// 非动画方式关闭弹层,直接关闭,不触发用户定义的Closed
 /// </summary>
 /// <param name="_layerId">弹层id</param>
 /// <param name="t"></param>
 public void CloseLIAyLayerNotTriggerClosed(string _layerId, AyLayer t)
 {
     AYUI.Session.Remove(_layerId);
     this.Visibility = Visibility.Collapsed;
     this.Opacity    = 0;
     Owner.Children.Remove(t);
 }
        public static AyLayer ShowDialog(object owner, object content, string title, AyLayerOptions options)
        {
            var messageBox = new AyLayer(owner, content, title, options, true);

            messageBox.Show();
            return(messageBox);
        }
 /// <summary>
 /// 动画方式关闭弹层
 /// </summary>
 /// <param name="_layerId">弹层id</param>
 /// <param name="t"></param>
 public void CloseAyLayer(string _layerId, AyLayer t)
 {
     if (_options.Closed.IsNotNull())
     {
         _options.Closed();
     }
     AYUI.Session.Remove(_layerId);
     t.CloseAyLayerTop();
 }
        /// <summary>
        /// 非动画方式关闭弹层,直接关闭
        /// </summary>
        /// <param name="_layerId">弹层id</param>
        /// <param name="t"></param>
        public void CloseLIAyLayer(string _layerId, AyLayer t)
        {
            if (_options.Closed.IsNotNull())
            {
                _options.Closed();
            }
            AYUI.Session.Remove(_layerId);
            this.Visibility = Visibility.Collapsed;
            this.Opacity    = 0;

            Owner.Children.Remove(t);
        }
 /// <summary>
 /// 动画方式,关闭时候不触发用户定义的Closed回调
 /// </summary>
 /// <param name="_layerId"></param>
 /// <param name="t"></param>
 public void CloseAyLayerNotTriggerClosed(string _layerId, AyLayer t)
 {
     AYUI.Session.Remove(_layerId);
     t.CloseAyLayerTop();
 }