public static void EditObject(IWin32Window owner, object value)
 {
     using var editor = new PropertyGridEx()
           {
               SelectedObject = value
           };
     XtraDialog.Show(owner, editor, "Edit object", MessageBoxButtons.OK);
 }
 public PropertyResolverEx(PropertyGridEx grid)
 {
     PropertyGrid = grid;
 }
 /// <summary> 
 /// Required method for Designer support - do not modify 
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.components = new System.ComponentModel.Container();
       System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PropertyPanel));
       this.propertyGrid = new CSharpFramework.Controls.PropertyGridEx();
       this.ToolStripButtonExpand = new System.Windows.Forms.ToolStripButton();
       this.ToolStripButtonCollapse = new System.Windows.Forms.ToolStripButton();
       this.ToolStripSeparator = new System.Windows.Forms.ToolStripSeparator();
       this.ToolStripButtonCopy = new System.Windows.Forms.ToolStripButton();
       this.ToolStripButtonPaste = new System.Windows.Forms.ToolStripButton();
       this.ToolStripSeparatorHelp = new System.Windows.Forms.ToolStripSeparator();
       this.ToolStripButtonRecentSelection = new System.Windows.Forms.ToolStripDropDownButton();
       this.dialogCaptionBar = new CSharpFramework.Controls.DialogCaptionBar();
       this.SuspendLayout();
       //
       // propertyGrid
       //
       this.propertyGrid.Dock = System.Windows.Forms.DockStyle.Fill;
       this.propertyGrid.HelpBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(252)))), ((int)(((byte)(252)))), ((int)(((byte)(252)))));
       this.propertyGrid.HelpBackgroundImage = ((System.Drawing.Image)(resources.GetObject("propertyGrid.HelpBackgroundImage")));
       this.propertyGrid.LineColor = System.Drawing.Color.FromArgb(((int)(((byte)(248)))), ((int)(((byte)(248)))), ((int)(((byte)(248)))));
       this.propertyGrid.Location = new System.Drawing.Point(0, 50);
       this.propertyGrid.Name = "propertyGrid";
       this.propertyGrid.Size = new System.Drawing.Size(330, 487);
       this.propertyGrid.TabIndex = 0;
       //
       //
       //
       this.propertyGrid.ToolStrip.AccessibleName = "ToolBar";
       this.propertyGrid.ToolStrip.AccessibleRole = System.Windows.Forms.AccessibleRole.ToolBar;
       this.propertyGrid.ToolStrip.AllowMerge = false;
       this.propertyGrid.ToolStrip.AutoSize = false;
       this.propertyGrid.ToolStrip.CanOverflow = false;
       this.propertyGrid.ToolStrip.Dock = System.Windows.Forms.DockStyle.None;
       this.propertyGrid.ToolStrip.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;
       this.propertyGrid.ToolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
     this.ToolStripButtonExpand,
     this.ToolStripButtonCollapse,
     this.ToolStripSeparator,
     this.ToolStripButtonCopy,
     this.ToolStripButtonPaste,
     this.ToolStripSeparatorHelp,
     this.ToolStripButtonRecentSelection});
       this.propertyGrid.ToolStrip.Location = new System.Drawing.Point(0, 1);
       this.propertyGrid.ToolStrip.Name = "";
       this.propertyGrid.ToolStrip.Padding = new System.Windows.Forms.Padding(2, 0, 1, 0);
       this.propertyGrid.ToolStrip.Size = new System.Drawing.Size(330, 25);
       this.propertyGrid.ToolStrip.TabIndex = 1;
       this.propertyGrid.ToolStrip.TabStop = true;
       this.propertyGrid.ToolStrip.Text = "PropertyGridToolBar";
       this.propertyGrid.ToolStrip.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.ToolStrip_ItemClicked);
       this.propertyGrid.SelectedGridItemChanged += new System.Windows.Forms.SelectedGridItemChangedEventHandler(this.propertyGrid_SelectedGridItemChanged);
       //
       // ToolStripButtonExpand
       //
       this.ToolStripButtonExpand.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
       this.ToolStripButtonExpand.Image = global::Editor.Properties.Resources.expand_all;
       this.ToolStripButtonExpand.ImageTransparentColor = System.Drawing.Color.Magenta;
       this.ToolStripButtonExpand.Name = "ToolStripButtonExpand";
       this.ToolStripButtonExpand.Size = new System.Drawing.Size(23, 22);
       this.ToolStripButtonExpand.Text = "Expand";
       this.ToolStripButtonExpand.Click += new System.EventHandler(this.button_ExpandAll_Click);
       //
       // ToolStripButtonCollapse
       //
       this.ToolStripButtonCollapse.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
       this.ToolStripButtonCollapse.Image = global::Editor.Properties.Resources.collapse_all;
       this.ToolStripButtonCollapse.ImageTransparentColor = System.Drawing.Color.Magenta;
       this.ToolStripButtonCollapse.Name = "ToolStripButtonCollapse";
       this.ToolStripButtonCollapse.Size = new System.Drawing.Size(23, 22);
       this.ToolStripButtonCollapse.Text = "Collapse";
       this.ToolStripButtonCollapse.Click += new System.EventHandler(this.button_CollapseAll_Click);
       //
       // ToolStripSeparator
       //
       this.ToolStripSeparator.Name = "ToolStripSeparator";
       this.ToolStripSeparator.Size = new System.Drawing.Size(6, 25);
       //
       // ToolStripButtonCopy
       //
       this.ToolStripButtonCopy.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
       this.ToolStripButtonCopy.Enabled = false;
       this.ToolStripButtonCopy.Image = global::Editor.Properties.Resources.copy;
       this.ToolStripButtonCopy.ImageTransparentColor = System.Drawing.Color.Magenta;
       this.ToolStripButtonCopy.Name = "ToolStripButtonCopy";
       this.ToolStripButtonCopy.Size = new System.Drawing.Size(23, 22);
       this.ToolStripButtonCopy.Text = "Copy";
       this.ToolStripButtonCopy.ToolTipText = "Copy all properties of the selected category (CTRL-C)";
       this.ToolStripButtonCopy.Click += new System.EventHandler(this.Button_CopyProperties_Click);
       //
       // ToolStripButtonPaste
       //
       this.ToolStripButtonPaste.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
       this.ToolStripButtonPaste.Enabled = false;
       this.ToolStripButtonPaste.Image = global::Editor.Properties.Resources.paste;
       this.ToolStripButtonPaste.ImageTransparentColor = System.Drawing.Color.Magenta;
       this.ToolStripButtonPaste.Name = "ToolStripButtonPaste";
       this.ToolStripButtonPaste.Size = new System.Drawing.Size(23, 22);
       this.ToolStripButtonPaste.Text = "Paste";
       this.ToolStripButtonPaste.ToolTipText = "Paste properties from the clipboard to the selected category (CTRL-V)";
       this.ToolStripButtonPaste.Click += new System.EventHandler(this.Button_PasteProperties_Click);
       //
       // ToolStripSeparatorHelp
       //
       this.ToolStripSeparatorHelp.Name = "ToolStripSeparatorHelp";
       this.ToolStripSeparatorHelp.Size = new System.Drawing.Size(6, 25);
       //
       // ToolStripButtonRecentSelection
       //
       this.ToolStripButtonRecentSelection.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
       this.ToolStripButtonRecentSelection.Image = global::Editor.Properties.Resources.toolbar_recent_selection;
       this.ToolStripButtonRecentSelection.ImageTransparentColor = System.Drawing.Color.Magenta;
       this.ToolStripButtonRecentSelection.Name = "ToolStripButtonRecentSelection";
       this.ToolStripButtonRecentSelection.Size = new System.Drawing.Size(29, 22);
       this.ToolStripButtonRecentSelection.ToolTipText = "List of recently selected objects";
       this.ToolStripButtonRecentSelection.DropDownOpening += new System.EventHandler(this.ToolStripButtonRecentSelection_DropDownOpening);
       //
       // dialogCaptionBar
       //
       this.dialogCaptionBar.BackColor = System.Drawing.SystemColors.Window;
       this.dialogCaptionBar.Caption = "Property Editor";
       this.dialogCaptionBar.Description = "Current Selection: <selection>";
       this.dialogCaptionBar.Dock = System.Windows.Forms.DockStyle.Top;
       this.dialogCaptionBar.HelpContext = "dialogs";
       this.dialogCaptionBar.HelpKey = null;
       this.dialogCaptionBar.HelpManual = null;
       this.dialogCaptionBar.Image = ((System.Drawing.Image)(resources.GetObject("dialogCaptionBar.Image")));
       this.dialogCaptionBar.Location = new System.Drawing.Point(0, 0);
       this.dialogCaptionBar.Name = "dialogCaptionBar";
       this.dialogCaptionBar.SetFontColor = System.Drawing.SystemColors.ControlText;
       this.dialogCaptionBar.ShowBorder = false;
       this.dialogCaptionBar.ShowBottomLine = true;
       this.dialogCaptionBar.Size = new System.Drawing.Size(330, 50);
       this.dialogCaptionBar.TabIndex = 19;
       //
       // PropertyPanel
       //
       this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
       this.ClientSize = new System.Drawing.Size(330, 537);
       this.CloseButton = false;
       this.Controls.Add(this.propertyGrid);
       this.Controls.Add(this.dialogCaptionBar);
       this.DockableAreas = ((WeifenLuo.WinFormsUI.DockAreas)(((WeifenLuo.WinFormsUI.DockAreas.Float | WeifenLuo.WinFormsUI.DockAreas.DockLeft)
     | WeifenLuo.WinFormsUI.DockAreas.DockRight)));
       this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
       this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
       this.Name = "PropertyPanel";
       this.TabText = "Properties";
       this.Text = "Properties";
       this.ResumeLayout(false);
 }
Beispiel #4
0
        private void PreparePropertyGridForPathTreeNode(PropertyGridEx.PropertyGridEx pgex, ShapeObject so)
        {
            List<PathTreeNode> ptn_list = new List<PathTreeNode>();
            PathTreeNode dummy = new PathTreeNode();
            dummy.Text = "No path";
            dummy.PathObject = null;
            ptn_list.Add(dummy);

            foreach (TreeNode tn in avstn.Nodes)
            {
                if(tn.GetType() == typeof(PathTreeNode))
                {
                    PathTreeNode ptn = (PathTreeNode)tn;
                    ptn_list.Add(ptn);
                }
            }

            ArrayList ary = new ArrayList(ptn_list);

            int v = 0;
            if (so.GetPathTreeNode().PathIndex != v) { v = so.GetPathTreeNode().PathIndex; }

            pgex.Item.Add("Path", ary[v], false, "Path", "Path of the shape", true);
            pgex.Item[pgex.Item.Count - 1].Choices = new PropertyGridEx.CustomChoices(ary);
        }
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.components = new System.ComponentModel.Container();
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PropertyPanel));
     this.propertyGrid                   = new CSharpFramework.Controls.PropertyGridEx();
     this.ToolStripButtonExpand          = new System.Windows.Forms.ToolStripButton();
     this.ToolStripButtonCollapse        = new System.Windows.Forms.ToolStripButton();
     this.ToolStripSeparator             = new System.Windows.Forms.ToolStripSeparator();
     this.ToolStripButtonCopy            = new System.Windows.Forms.ToolStripButton();
     this.ToolStripButtonPaste           = new System.Windows.Forms.ToolStripButton();
     this.ToolStripSeparatorHelp         = new System.Windows.Forms.ToolStripSeparator();
     this.ToolStripButtonRecentSelection = new System.Windows.Forms.ToolStripDropDownButton();
     this.ToolStripButtonSettings        = new System.Windows.Forms.ToolStripDropDownButton();
     this.ToolStripMenuItemHelp          = new System.Windows.Forms.ToolStripMenuItem();
     this.ToolStripMenuItemCaption       = new System.Windows.Forms.ToolStripMenuItem();
     this.dialogCaptionBar               = new CSharpFramework.Controls.DialogCaptionBar();
     this.SuspendLayout();
     //
     // propertyGrid
     //
     this.propertyGrid.Dock                = System.Windows.Forms.DockStyle.Fill;
     this.propertyGrid.HelpBackColor       = System.Drawing.Color.FromArgb(((int)(((byte)(252)))), ((int)(((byte)(252)))), ((int)(((byte)(252)))));
     this.propertyGrid.HelpBackgroundImage = ((System.Drawing.Image)(resources.GetObject("propertyGrid.HelpBackgroundImage")));
     this.propertyGrid.LineColor           = System.Drawing.Color.FromArgb(((int)(((byte)(248)))), ((int)(((byte)(248)))), ((int)(((byte)(248)))));
     this.propertyGrid.Location            = new System.Drawing.Point(0, 50);
     this.propertyGrid.Name                = "propertyGrid";
     this.propertyGrid.Size                = new System.Drawing.Size(330, 487);
     this.propertyGrid.TabIndex            = 0;
     //
     //
     //
     this.propertyGrid.ToolStrip.AccessibleName = "ToolBar";
     this.propertyGrid.ToolStrip.AccessibleRole = System.Windows.Forms.AccessibleRole.ToolBar;
     this.propertyGrid.ToolStrip.AllowMerge     = false;
     this.propertyGrid.ToolStrip.AutoSize       = false;
     this.propertyGrid.ToolStrip.CanOverflow    = false;
     this.propertyGrid.ToolStrip.Dock           = System.Windows.Forms.DockStyle.None;
     this.propertyGrid.ToolStrip.GripStyle      = System.Windows.Forms.ToolStripGripStyle.Hidden;
     this.propertyGrid.ToolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
         this.ToolStripButtonExpand,
         this.ToolStripButtonCollapse,
         this.ToolStripSeparator,
         this.ToolStripButtonCopy,
         this.ToolStripButtonPaste,
         this.ToolStripSeparatorHelp,
         this.ToolStripButtonRecentSelection,
         this.ToolStripButtonSettings
     });
     this.propertyGrid.ToolStrip.Location       = new System.Drawing.Point(0, 1);
     this.propertyGrid.ToolStrip.Name           = "";
     this.propertyGrid.ToolStrip.Padding        = new System.Windows.Forms.Padding(2, 0, 1, 0);
     this.propertyGrid.ToolStrip.Size           = new System.Drawing.Size(330, 25);
     this.propertyGrid.ToolStrip.TabIndex       = 1;
     this.propertyGrid.ToolStrip.TabStop        = true;
     this.propertyGrid.ToolStrip.Text           = "PropertyGridToolBar";
     this.propertyGrid.ToolStrip.ItemClicked   += new ToolStripItemClickedEventHandler(ToolStrip_ItemClicked);
     this.propertyGrid.SelectedGridItemChanged += new System.Windows.Forms.SelectedGridItemChangedEventHandler(this.propertyGrid_SelectedGridItemChanged);
     //
     // ToolStripButtonExpand
     //
     this.ToolStripButtonExpand.DisplayStyle          = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
     this.ToolStripButtonExpand.Image                 = global::Editor.Properties.Resources.expand_all;
     this.ToolStripButtonExpand.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.ToolStripButtonExpand.Name   = "ToolStripButtonExpand";
     this.ToolStripButtonExpand.Size   = new System.Drawing.Size(23, 22);
     this.ToolStripButtonExpand.Text   = "Expand";
     this.ToolStripButtonExpand.Click += new System.EventHandler(this.button_ExpandAll_Click);
     //
     // ToolStripButtonCollapse
     //
     this.ToolStripButtonCollapse.DisplayStyle          = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
     this.ToolStripButtonCollapse.Image                 = global::Editor.Properties.Resources.collapse_all;
     this.ToolStripButtonCollapse.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.ToolStripButtonCollapse.Name   = "ToolStripButtonCollapse";
     this.ToolStripButtonCollapse.Size   = new System.Drawing.Size(23, 22);
     this.ToolStripButtonCollapse.Text   = "Collapse";
     this.ToolStripButtonCollapse.Click += new System.EventHandler(this.button_CollapseAll_Click);
     //
     // ToolStripSeparator
     //
     this.ToolStripSeparator.Name = "ToolStripSeparator";
     this.ToolStripSeparator.Size = new System.Drawing.Size(6, 25);
     //
     // ToolStripButtonCopy
     //
     this.ToolStripButtonCopy.DisplayStyle          = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
     this.ToolStripButtonCopy.Enabled               = false;
     this.ToolStripButtonCopy.Image                 = global::Editor.Properties.Resources.copy;
     this.ToolStripButtonCopy.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.ToolStripButtonCopy.Name        = "ToolStripButtonCopy";
     this.ToolStripButtonCopy.Size        = new System.Drawing.Size(23, 22);
     this.ToolStripButtonCopy.Text        = "Copy";
     this.ToolStripButtonCopy.ToolTipText = "Copy all properties of the selected category (CTRL-C)";
     this.ToolStripButtonCopy.Click      += new System.EventHandler(this.Button_CopyProperties_Click);
     //
     // ToolStripButtonPaste
     //
     this.ToolStripButtonPaste.DisplayStyle          = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
     this.ToolStripButtonPaste.Enabled               = false;
     this.ToolStripButtonPaste.Image                 = global::Editor.Properties.Resources.paste;
     this.ToolStripButtonPaste.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.ToolStripButtonPaste.Name        = "ToolStripButtonPaste";
     this.ToolStripButtonPaste.Size        = new System.Drawing.Size(23, 22);
     this.ToolStripButtonPaste.Text        = "Paste";
     this.ToolStripButtonPaste.ToolTipText = "Paste properties from the clipboard to the selected category (CTRL-V)";
     this.ToolStripButtonPaste.Click      += new System.EventHandler(this.Button_PasteProperties_Click);
     //
     // ToolStripSeparatorHelp
     //
     this.ToolStripSeparatorHelp.Name = "ToolStripSeparatorHelp";
     this.ToolStripSeparatorHelp.Size = new System.Drawing.Size(6, 25);
     //
     // ToolStripButtonRecentSelection
     //
     this.ToolStripButtonRecentSelection.DisplayStyle          = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
     this.ToolStripButtonRecentSelection.Image                 = global::Editor.Properties.Resources.toolbar_recent_selection;
     this.ToolStripButtonRecentSelection.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.ToolStripButtonRecentSelection.Name             = "ToolStripButtonRecentSelection";
     this.ToolStripButtonRecentSelection.Size             = new System.Drawing.Size(29, 22);
     this.ToolStripButtonRecentSelection.ToolTipText      = "List of recently selected objects";
     this.ToolStripButtonRecentSelection.DropDownOpening += new EventHandler(ToolStripButtonRecentSelection_DropDownOpening);
     //
     // ToolStripButtonSettings
     //
     this.ToolStripButtonSettings.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
     this.ToolStripButtonSettings.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
         this.ToolStripMenuItemHelp,
         this.ToolStripMenuItemCaption
     });
     this.ToolStripButtonSettings.Image = global::Editor.Properties.Resources.toolbar_export_settings;
     this.ToolStripButtonSettings.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.ToolStripButtonSettings.Name = "ToolStripButtonSettings";
     this.ToolStripButtonSettings.Size = new System.Drawing.Size(29, 22);
     this.ToolStripButtonSettings.Text = "Settings";
     //
     // ToolStripMenuItemHelp
     //
     this.ToolStripMenuItemHelp.Checked      = true;
     this.ToolStripMenuItemHelp.CheckOnClick = true;
     this.ToolStripMenuItemHelp.CheckState   = System.Windows.Forms.CheckState.Checked;
     this.ToolStripMenuItemHelp.Image        = global::Editor.Properties.Resources.toolbar_help;
     this.ToolStripMenuItemHelp.Name         = "ToolStripMenuItemHelp";
     this.ToolStripMenuItemHelp.Size         = new System.Drawing.Size(186, 22);
     this.ToolStripMenuItemHelp.Text         = "Show Property Description";
     this.ToolStripMenuItemHelp.Click       += new System.EventHandler(this.button_PropertyDescription_Click);
     //
     // ToolStripMenuItemCaption
     //
     this.ToolStripMenuItemCaption.Checked      = true;
     this.ToolStripMenuItemCaption.CheckOnClick = true;
     this.ToolStripMenuItemCaption.CheckState   = System.Windows.Forms.CheckState.Checked;
     this.ToolStripMenuItemCaption.Image        = global::Editor.Properties.Resources.toolbar_caption;
     this.ToolStripMenuItemCaption.Name         = "ToolStripMenuItemCaption";
     this.ToolStripMenuItemCaption.Size         = new System.Drawing.Size(186, 22);
     this.ToolStripMenuItemCaption.Text         = "Show Caption Bar";
     this.ToolStripMenuItemCaption.Click       += new System.EventHandler(this.button_CaptionBar_Click);
     //
     // dialogCaptionBar
     //
     this.dialogCaptionBar.BackColor       = System.Drawing.SystemColors.Window;
     this.dialogCaptionBar.Caption         = "Property Editor";
     this.dialogCaptionBar.CompactView     = false;
     this.dialogCaptionBar.Description     = "Current Selection: <selection>";
     this.dialogCaptionBar.Dock            = System.Windows.Forms.DockStyle.Top;
     this.dialogCaptionBar.Image           = ((System.Drawing.Image)(resources.GetObject("dialogCaptionBar.Image")));
     this.dialogCaptionBar.Location        = new System.Drawing.Point(0, 0);
     this.dialogCaptionBar.Name            = "dialogCaptionBar";
     this.dialogCaptionBar.SetFontColor    = System.Drawing.SystemColors.ControlText;
     this.dialogCaptionBar.ShowBorder      = false;
     this.dialogCaptionBar.ShowBottomLine  = true;
     this.dialogCaptionBar.ShowCaptionText = true;
     this.dialogCaptionBar.ShowImage       = true;
     this.dialogCaptionBar.Size            = new System.Drawing.Size(330, 50);
     this.dialogCaptionBar.TabIndex        = 19;
     //
     // PropertyPanel
     //
     this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     this.AutoScaleMode       = System.Windows.Forms.AutoScaleMode.Font;
     this.ClientSize          = new System.Drawing.Size(330, 537);
     this.CloseButton         = false;
     this.Controls.Add(this.propertyGrid);
     this.Controls.Add(this.dialogCaptionBar);
     this.DockableAreas = ((WeifenLuo.WinFormsUI.DockAreas)(((WeifenLuo.WinFormsUI.DockAreas.Float | WeifenLuo.WinFormsUI.DockAreas.DockLeft)
                                                             | WeifenLuo.WinFormsUI.DockAreas.DockRight)));
     this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
     this.Icon            = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
     this.Name            = "PropertyPanel";
     this.TabText         = "Properties";
     this.Text            = "Properties";
     this.Load           += new System.EventHandler(this.PropertyPanel_Load);
     this.ResumeLayout(false);
 }
Beispiel #6
0
 private void Reset_Click(object sender, RoutedEventArgs e)
 {
     // TODO: Reset should probably be in ViewModel and platform-agnostic.
     PropertyGridEx.ResetValues();
 }
Beispiel #7
0
        /// <summary>
        /// Add Components to PropertyGridEx
        /// </summary>
        /// <returns></returns>
        public static void AddComponetToPropertyGridEx(string component_, string category_, PropertyGridEx.PropertyGridEx p)
        {
            //Console.Write("Schema Recieved \n" + entityXML);
            p.Item.Clear();
            var types = from type in ClassSchemaXML.GetclassSchemaXML().Descendants("type")
                        where type.Attribute("name").Value.ToString().Replace("::", ".") == component_
                        select new
                        {
                            name = type.Attribute("name").Value,
                            def = type.Descendants("factory"),
                        };

            foreach (var type in types)
            {
                string name = "Name: " + type.name;
                Console.WriteLine(name);
                Console.WriteLine(type.def.ToString());

                var accessors = type.def.Descendants("accessor");
                var variables = type.def.Descendants("variable");

                var accessorsList = from accessor in accessors
                                    select new
                                    {
                                        name = accessor.Attribute("name").Value,
                                        access = accessor.Attribute("access").Value,
                                        type = accessor.Attribute("type").Value,
                                        def = accessor,//.Descendants("metadata"),
                                    };

                //XElement comp = new XElement("component", new XAttribute("type", component_), new XAttribute("name", "Spatial")
                //                            );
                foreach (var acc in accessorsList)
                {

                    if (acc.type.ToString() == "Number" || acc.type.ToString() == "int" || acc.type.ToString() == "uint")
                    {
                        p.Item.Add(acc.name, 0, false, category_, "", true);
                        //comp.Add(new XElement(acc.name, 0));
                    }

                    if (acc.type.ToString() == "Boolean")
                    {
                        p.Item.Add(acc.name, true, false, category_, "", true);
                        //comp.Add(new XElement(acc.name, true));
                    }

                    if (acc.type.ToString() == "flash.geom::Point")
                    {
                        p.Item.Add(acc.name, new Point2D(10, 10), false, category_, "", true);
                        //comp.Add(new XElement(acc.name, new XElement("x", 0),
                                //                        new XElement("y", 0)
                                //             )
                                //);
                    }

                    if (acc.type.ToString() == "com.pblabs.engine.core::ObjectType")
                    {
                        p.Item.Add(acc.name, "", false, category_, "", true);
                        p.Item[p.Item.Count - 1].Choices = new PropertyGridEx.CustomChoices(new string[] { "Template1", "Template2" }, true); //get all object types
                        //comp.Add(new XElement(acc.name, true));
                    }

                    if (acc.type.ToString() == "Array")
                    {
                        var metas = from meta in acc.def.Descendants("metadata")
                                    select new
                                    {
                                        name = meta.Attribute("name").Value,
                                        def = meta,
                                    };

                        foreach (var meta in metas)
                        {
                            var args = from arg in meta.def.Descendants("arg")
                                       where arg.Attribute("key").Value.ToString() == "type"
                                       select new
                                       {
                                           key = arg.Attribute("key").Value,
                                           value = arg.Attribute("value").Value,
                                       };
                            foreach (var arg in args)
                            {
                                p.Item.Add(acc.name, "", false, category_, "", true);
                                p.Item[p.Item.Count - 1].Value = arg.value;
                                p.Item[p.Item.Count - 1].CustomEditor = new ArrayEditorUI();// new MyEditor(arg.value);
                            }
                        }

                    }
                }

                var variablesList = from variable in variables
                                    select new
                                    {
                                        name = variable.Attribute("name").Value,
                                        type = variable.Attribute("type").Value,
                                        def = variable.Descendants("metadata"),
                                    };

                foreach (var acc in variablesList)
                {
                    if (acc.type.ToString() == "Number" || acc.type.ToString() == "int")
                        p.Item.Add(acc.name, 0, false, "Spatial", "", true);

                    if (acc.type.ToString() == "Boolean")
                        p.Item.Add(acc.name, true, false, "Spatial", "", true);

                    if (acc.type.ToString() == "flash.geom::Point")
                        p.Item.Add(acc.name, new Point(10, 10), false, "Spatial", "", true);
                }
                p.Refresh();
            }
        }