Hello,
I try create a custom component from GroupBar Control.
I would like add 2 default GroupBarItems (with name: PanelPrimary, PanelSecondary) and add it to the initial state of my custom component. I can build the code, but I cannot place the component in Form, because I get this error message after I drag the control from toolbar:
I mark the code part with bold that cause the error:
So I add new Component Class to my project and add this code:
public partial class MyAlternatePanel : GroupBar
{
public Syncfusion.Windows.Forms.Tools.GroupBarItem PanelPrimary;
public Syncfusion.Windows.Forms.Tools.GroupBarItem PanelSecondary;
public MyAlternatePanel()
{
InitializeComponent();
Build();
}
public MyAlternatePanel(IContainer container)
{
container.Add(this);
InitializeComponent();
Build();
}
private void Build() {
this.BackColor = System.Drawing.SystemColors.Control;
this.BorderColor = System.Drawing.Color.White;
this.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.ExpandButtonToolTip = null;
this.FlatLook = true;
this.ForeColor = System.Drawing.Color.White;
this.GroupBarDropDownToolTip = null;
this.GroupBarItemHeight = 0;
this.IndexOnVisibleItems = true;
this.MinimizeButtonToolTip = null;
this.NavigationPaneButtonWidth = 0;
this.NavigationPaneHeight = 0;
this.NavigationPaneTooltip = null;
this.PopupClientSize = new System.Drawing.Size(0, 0);
this.PopupResizeMode = Syncfusion.Windows.Forms.Tools.PopupResizeMode.None;
this.ShowChevron = false;
this.ShowNavigationPane = false;
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.SmartSizeBox = false;
this.ThemeName = "Metro";
this.ThemeStyle.BorderThickness = 0;
this.VisualStyle = Syncfusion.Windows.Forms.VisualStyle.Metro;
// this.PanelPrimary.Client = new Panel(); <- I would like add this in form-designer
this.PanelPrimary.Text = "Primary Panel [ID: 0]";
this.PanelPrimary.Visible = false;
// this.PanelSecondary.Client = new Panel(); <- I would like add this in form-designer
this.PanelSecondary.Text = "SecondaryPanel [ID: 1]";
this.PanelSecondary.Visible = false;
this.GroupBarItems.AddRange(new Syncfusion.Windows.Forms.Tools.GroupBarItem[] {
this.PanelPrimary,
this.PanelSecondary
});
}
}
I would like to add child control to the PanelPrimary and PanelSecondary GroupbarItems in form designer. (I can switch with editing the SelectedItem property at design time).
Do you have any idea how should I modify the bold part of code to accept initial groupbaritems definition and show the control properly in VS form designer?
Thank you very much!
Best Regards, SZL
Hi,
We are validating your reported issue. We will provide the solution or complete details within two business days.
Hi,
To resolve this
issue, you will need to create instances for the GroupBarItems: PanelPrimary
and PanelSecondary and add them to the initial state of your custom component.
This can be done by adding the following code snippet to your project:
public GroupBarItem PanelPrimary = new GroupBarItem(); public GroupBarItem PanelSecondary = new GroupBarItem(); |
You can also create instances for GroupBarItems in the constructor of your custom component. We have also provided a simple sample for your reference.
Please let us know if you have any other queries.