Note that there are some explanatory texts on larger screens.

plurals
  1. POAdd sub controls to custom control after click the "OK" button of the "CollectionEditor" window in design time
    primarykey
    data
    text
    <p>I've created my custom control. It has a property that is called "Tab." This property adds a collection of "FloorsInformation" controls that are inherited from "DockContainerItem" class to my custom control.</p> <p><img src="https://i.stack.imgur.com/ZlHll.jpg" alt="My custom control properties"></p> <p>Now, I want to add "FloorsInformation" controls to my custom control after click the "OK" button of the Tab "CollectionEditor" window.</p> <p><img src="https://i.stack.imgur.com/XVgPt.jpg" alt="&quot;Tabs Collection Editor&quot; window"></p> <p>I have "AddTabs" method for doing that. However, I can't call it in the right place. I must call "AddTabs" method in "set accessor" of the "Tab" property, but it never occurs.</p> <p>I also can call this method from "get accessor" of the "Tab" property, but calling this method in "get accessor" of the "Tab" property will result in an error, because the program access to the "get accessor" of the "Tab" property continuously.</p> <pre><code>[Designer("System.Windows.Forms.Design.ParentControlDesigner, System.Design", typeof(IDesigner))] [ToolboxItem(true), ToolboxBitmap(typeof(ToolboxIconResourceFinder), "FloorsGrouping.bmp")] [DisplayName("Floors Group")] [Editor("WindowsFormsControlLibrary2.FloorsGrouping, WindowsFormsControlLibrary2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=197889249da45bfc", typeof(UITypeEditor))] [Description("Floorssssssss")] [Category("Saino")] [DefaultProperty("Text")] [DesignerCategory("Component")] //Form //Designer //Empty String ("") public partial class FloorsGrouping : Bar { private Tabs tabs = new Tabs(); public FloorsGrouping() { InitializeComponent(); this.AutoHide = true; } [Category("Data")] [DisplayName("Tabs")] [Description("Tabsssssssssssss")] [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] [Editor(typeof(ItemsCollectionEditor), typeof(UITypeEditor))] public Tabs Tab { get { //AddTabs(); return tabs; } //set //{ //AddTabs(); //} } public void AddTabs() { foreach (DockContainerItem dciItem in Tab) { if (!Parent.Controls.ContainsKey(dciItem.Name)) { Items.Add(dciItem); } } } } [DisplayName("Floors Information")] [Description("Floors Informationnnnnnnnnnnnnnnn")] [DefaultProperty("Text")] [DesignerCategory("Component")] [ToolboxItem(false)] public class FloorsInformation : DockContainerItem { /// &lt;summary&gt; /// Required designer variable. /// &lt;/summary&gt; private System.ComponentModel.IContainer components = null; private SimilarFloorsInformation similarFloorsInformation = new SimilarFloorsInformation(); private AllFloorsInformation allFloorsInformation = new AllFloorsInformation(); private string text = "Floors Information"; public FloorsInformation() { } [Category("Data")] [DisplayName("Similar Floors Panel")] [Description("Similar Floors Panellllllllllllllllllll")] [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] public SimilarFloorsInformation SimilarFloorsInfo { get { return similarFloorsInformation; } set { similarFloorsInformation = value; } } [Category("Data")] [DisplayName("All Floors Group")] [Description("All Floors Groupppppppppppppp")] [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] public AllFloorsInformation AllFloorsInfo { get { return allFloorsInformation; } set { allFloorsInformation = value; } } protected override void Dispose(bool disposing) { if (disposing &amp;&amp; (components != null)) { components.Dispose(); } base.Dispose(disposing); } } public class Tabs : CollectionBase { public FloorsInformation this[int intIndex] { get { return (FloorsInformation)InnerList[intIndex]; } set { InnerList[intIndex] = value; } } public int Add(FloorsInformation finfItemType) { return InnerList.Add(finfItemType); } public bool Contains(FloorsInformation finfItemType) { return InnerList.Contains(finfItemType); } public void Remove(FloorsInformation finfItemType) { InnerList.Remove(finfItemType); } public void Insert(int intIndex, FloorsInformation finfItemType) { InnerList.Insert(intIndex, finfItemType); } public FloorsInformation[] GetValues() { FloorsInformation[] finfItemType = new FloorsInformation[InnerList.Count]; InnerList.CopyTo(0, finfItemType, 0, InnerList.Count); return finfItemType; } } </code></pre> <p>By the way, I can call this method in "SetItems" overrode method of the "ItemsCollectionEditor" class that is inherited from "CollectionEditor" class; nevertheless, I can't access to "AddTabs" method without create a new instance of my custom control class. If I create a new instance of my custom control, "AddTabs" method applies changes on a new control of my custom control and not on the current added custom control in the WinForm.</p> <pre><code>public class ItemsCollectionEditor : CollectionEditor { private Type[] typItems; public ItemsCollectionEditor(Type typItem) : base(typItem) { typItems = new Type[] { typeof(FloorsInformation) }; } protected override Type[] CreateNewItemTypes() { return typItems; } protected override CollectionForm CreateCollectionForm() { CollectionForm collectionForm = base.CreateCollectionForm(); collectionForm.Text = "Tabs Collection Editor"; return collectionForm; //return base.CreateCollectionForm(); } protected override object SetItems(object editValue, object[] value) { return base.SetItems(editValue, value); } } </code></pre> <p>What must I do for achieve to my goal?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload