Exemplo n.º 1
0
 /// <summary>
 /// 控件位置更新
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void _ControlPositionMethod(object sender, ControlModifyPropertyEventArgs e)
 {
     if (null != ControlPosition)
     {
         ControlPosition(sender, e);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// 更新属性
 /// </summary>
 /// <param name="e"></param>
 internal void UpdateProperty(ControlModifyPropertyEventArgs e)
 {
     if (null == item || 0 == item.Count)
     {
         return;
     }
     //-->更新属性操作
     foreach (var v in item)
     {
         if (null == v || v.Name.IsNullOrEmpty())
         {
             continue;
         }
         if (e.DictProperty.ContainsKey(v.Name))
         {
             object obj = spPValue.FindName("pgec_" + v.Name);
             PropertyGridEvaluationCtrl pgec = obj as PropertyGridEvaluationCtrl;
             if (null == pgec)
             {
                 continue;
             }
             pgec.EvaluationValue = e.DictProperty[v.Name];
         }
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// DesignRectangle控件鼠标左键弹起
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void dr_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            DesignRectangle item = sender as DesignRectangle;

            item.ReleaseMouseCapture();
            mouseVerticalPosition   = -1;
            mouseHorizontalPosition = -1;
            if (null != _CurrentDesignCtrl && !this._CurrentDesignCtrl.Equals(item.Tag as FrameworkElement))
            {
                item.Tag = this._CurrentDesignCtrl;
                SetControlFocus(_CurrentDesignCtrl);
            }
            _IDesigntime.UpdateCurrentSelectedCtrl(this._CurrentDesignCtrl);
            if (isMoveByDesignRectangle)
            {   //-->判断当前选中的控件与
                double newTop  = (double)item.GetValue(Canvas.TopProperty);
                double newLeft = (double)item.GetValue(Canvas.LeftProperty);
                ControlModifyPropertyEventArgs ce = new ControlModifyPropertyEventArgs();
                ce.DictProperty.Add("Canvas.Top", newTop);
                ce.DictProperty.Add("Canvas.Left", newLeft);
                ce.ControlName = string.Format("{0}", _CurrentDesignCtrl.Name);
                _ControlPositionMethod(this, ce);
            }
            isMouseCaptured = false;
            e.Handled       = true;

            line_Top.Visibility  = System.Windows.Visibility.Collapsed;
            line_Left.Visibility = System.Windows.Visibility.Collapsed;
        }
Exemplo n.º 4
0
        /// <summary>
        /// DesignRectangle控件上的Auchor控件鼠标左键弹起
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void dr_MouseLeftUp(object sender, MouseButtonEventArgs e)
        {
            DesignRectangle item = sender as DesignRectangle;

            if (null != _CurrentDesignCtrl)
            {
                _CurrentDesignCtrl.Width  = item.Width;
                _CurrentDesignCtrl.Height = item.Height;
            }
            ControlModifyPropertyEventArgs ce = new ControlModifyPropertyEventArgs();

            ce.DictProperty.Add("Height", dr.Height);
            ce.DictProperty.Add("Width", dr.Width);
            ce.ControlName = string.Format("{0}", _CurrentDesignCtrl.GetPropertyValue("Name"));// Wrapper.GetPropertyValue(_CurrentDesignCtrl, "Name"));
            _ControlPositionMethod(this, ce);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 控件位置改变
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void PageDesign_ControlPosition(object sender, ControlModifyPropertyEventArgs e)
        {
            string controlName = e.ControlName;

            if (!_XamlTemplate.CanvasTemplate.Children.ContainsKey(controlName))
            {
                return;
            }
            this.IsUpdate = true;
            string controlXaml = _XamlTemplate.CanvasTemplate.Children[controlName];

            controlXaml = Wrapper.ModifyXamlAttribute(e.DictProperty, controlXaml);
            if (_XamlTemplate.CanvasTemplate.Children.ContainsKey(controlName))
            {
                _XamlTemplate.CanvasTemplate.Children.Remove(controlName);
            }
            _XamlTemplate.CanvasTemplate.Children.Add(controlName, controlXaml);
            _ControlPositionMethod(sender, e);
            Xaml_Template = _XamlTemplate.ParseXml().ToString();
        }
Exemplo n.º 6
0
        void PageDesign_KeyUp(object sender, KeyEventArgs e)
        {
            //if (e.Key == Key.Delete)
            //{
            //    DeleteCurrentSelectedControl();
            //    return;
            //}
            //-->修改xaml里的值。
            double newTop  = (double)dr.GetValue(Canvas.TopProperty);
            double newLeft = (double)dr.GetValue(Canvas.LeftProperty);
            ControlModifyPropertyEventArgs ce = new ControlModifyPropertyEventArgs();

            ce.DictProperty = new Dictionary <string, object>();
            ce.DictProperty.Add("Canvas.Top", newTop);
            ce.DictProperty.Add("Canvas.Left", newLeft);
            ce.DictProperty.Add("Height", dr.Height);
            ce.DictProperty.Add("Width", dr.Width);
            ce.ControlName = string.Format("{0}", _CurrentDesignCtrl.Name);
            _ControlPositionMethod(this, ce);
        }
 void pwag_ControlPosition(object sender, ControlModifyPropertyEventArgs e)
 {
     //-->告诉属性控件,属性有变。
     pcc.UpdateProperty(e);
 }
 /// <summary>
 /// 更新属性
 /// </summary>
 /// <param name="e"></param>
 public void UpdateProperty(ControlModifyPropertyEventArgs e)
 {
     pgProperty.UpdateProperty(e);
 }
 void pwa_ControlPosition(object sender, ControlModifyPropertyEventArgs e)
 {
     _ControlPositionMethod(sender, e);
 }