Example #1
0
        public void RefreshPropertiesGrid(ControlDesigner sourceControl)
        {
            SourceControl = sourceControl;
            var control = SourceControl.RealControl;

            Model = new ControlModel
            {
                X                = control.Location.X,
                Y                = control.Location.Y,
                Width            = control.Size.Width,
                Height           = control.Size.Height,
                CanCaptionChange = TranslationToolHelperWinClient.IsEditableControl(control)
            };

            if (Model.CanCaptionChange)
            {
                Model.OldCaption  =
                    Model.Caption =
                        TranslationToolHelperWinClient.GetComponentText(control);
            }
            else
            {
                rowCaption.Visible = false;
            }

            if (SourceControl.MovingEnabled)
            {
                Model.OldLocation = control.Location;
            }
            else
            {
                categoryLocation.Visible = false;
            }

            if (SourceControl.SizingEnabled)
            {
                Model.OldSize = control.Size;
            }
            else
            {
                categorySize.Visible = false;
            }

            //we create a list with all menu items
            if (control is PopUpButton)
            {
                var pb = (PopUpButton)control;
                foreach (BarButtonItemLink action in pb.PopupActions.ItemLinks)
                {
                    Model.MenuItems.Add(action.Item.Caption);
                }
                categoryMenuItems.Visible = true;
            }
            else
            {
                categoryMenuItems.Visible = false;
            }

            propGrid.SelectedObject = Model;
        }
Example #2
0
 public void RefreshPropertiesGrid(BarItemLinkCollection sourceControl)
 {
     rowCaption.Visible        = categoryLocation.Visible = categorySize.Visible = false;
     categoryMenuItems.Visible = true;
     Model = new ControlModel
     {
         CanCaptionChange = false
     };
     foreach (var o in sourceControl)
     {
         var caption = String.Empty;
         if (o is BarSubItemLink)
         {
             caption = ((BarSubItemLink)o).Item.Caption;
         }
         else if (o is BarLargeButtonItemLink)
         {
             caption = ((BarLargeButtonItemLink)o).Item.Caption;
         }
         if (caption.Length == 0)
         {
             continue;
         }
         Model.MenuItems.Add(caption);
     }
     propGrid.SelectedObject = Model;
 }