Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Panelbar (obsolete as of Q2 2010) > add dynamic labels to radPanelbarGroupElement.ContentPanel

add dynamic labels to radPanelbarGroupElement.ContentPanel

Feed from this thread
  • Posted on Oct 23, 2007 (permalink)

    When I add labels dynamically to the content panel, the content panel only displays the first label added.  When I convert the labels to radLabelElements and add them directly to the groupElement, all of them display but the content panel is pushed south causing my panelbar to scroll.

    This is how I add labels to the content panel (only first one shows):
    Label lbl = new Label();
    lbl.Text = "HI";
    grpElement1.ContentPanel.Controls.Add(lbl);
    Label lbl2 = new Label();
    lbl2.Text = "HI2";
    grpElement1.ContentPanel.Controls.Add(lbl2);

    This is how I add radGroupElements to the groupElement (pushes contentPanel south):
    RadLabelElement lbl = new RadLabelElement();
    lbl.Text = "HI";
    grpElement1.Items.Add(lbl);

    I would really just like to add labels to the content panel since my theme has it looking nice... Can someone please give me a tip on how to fix this?
    Thanks - Kerri

    Reply

  • Jordan Jordan admin's avatar

    Posted on Oct 24, 2007 (permalink)

    Hi Kerri,

    It seems that because you have not set their location, all labels have a location of (0, 0). If you set the location the way illustrated in the code bellow all labels are shown:

    Label lbl1 = new Label(); 
    lbl1.Text = "Label1"
    lbl1.Location = new Point(0, 0);            this.radPanelBarGroupElement5.ContentPanel.Controls.Add(lbl1); 
     
    Label lbl2 = new Label(); 
    lbl2.Text = "Label2"
    lbl2.Location = new Point(0, 25); 
    this.radPanelBarGroupElement5.ContentPanel.Controls.Add(lbl2); 
     
    Label lbl3 = new Label(); 
    lbl3.Text = "Label3"
    lbl3.Location = new Point(0, 50);           this.radPanelBarGroupElement5.ContentPanel.Controls.Add(lbl3); 


    Thank you for writing. Do not hesitate to contact us if you need any further assistance.

    Greetings,
    Jordan
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center

    Reply

  • Posted on Oct 24, 2007 (permalink)

    Yep fixed it.  Thanks.

    Reply

  • Tim avatar

    Posted on May 7, 2009 (permalink)

    I want to add RadlabelElements directly to the PanelBarGroupElement as in Kerri's example:

    RadLabelElement lbl = new RadLabelElement();
    lbl.Text = "HI";
    grpElement1.Items.Add(lbl);

    How can I do that without the pushing the content panel south behaviour?

    Thanks - Tim.

     

    Reply

  • Boyko Markov Boyko Markov admin's avatar

    Posted on May 11, 2009 (permalink)

    Hello Tim,

    You should use the ContentPanel only when you add Controls and whenever the groupElement EnableHostControlMode property value is true, otherwise you should use the Items collection of RadPanelBarGroupElement to directly add any items such as RadLabelElements.

    Here is sample code demonstrating how to add a label element to RadPanelBarGroupElement

       RadLabelElement label = new RadLabelElement();
                label.Text = "test";
                this.radPanelBarGroupElement1.Items.Add(label);

    I hope this helps. Do not hesitate to write me back if you have further questions.

    All the best,
    Boyko Markov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.

    Reply

  • Tim avatar

    Posted on May 11, 2009 (permalink)

    Thanks, that did it.

    Reply

  • YING JANG LIN avatar

    Posted on Apr 8, 2010 (permalink)

    Hi,

    In Tim's example.

    1,I have 3 group item . each item have 3 or 5 label , I hope can catch which label of group had clicked.

    group 1
    -----------
     g1label1
     g1label2

    group 2
     ----------
     g2label1
     g2label2
     g2label3

    2, How set space for item at group?
    group 1
    ---------
    <space2 > g1label1
     <space 2> g1label1
    group 2
    ---------
    <space3> g2label2
                .
                .
                .

    3,How to set nest group item?
        Gorup 1
        ----------
       <space 3> subgroup 1
            ------------------------
               <space 5> g1 sub1 label1
               <space 5> g1 sub1 label2
       <space 3> subgroup 2
              <space 5> g1 sub2 label1
               <space 5> g1 sub2 label2
    Gorup 2
    ----------
       <space 3> subgroup 1
            ------------------------
               <space 5> g2 sub1 label1
               <space 5> g2 sub1 label2
       <space 3> subgroup 2
              <space 5> g2 sub2 label1
               <space 5> g2 sub2 label2

    Hope can help me and code in VB.net

    Thanks

    Reply

  • Vassil Petev Vassil Petev admin's avatar

    Posted on Apr 16, 2010 (permalink)

    Hi YING JANG LIN,

    Please, check the panelbar documentation on how to work with the control.


    All the best,
    Vassil
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.

    Reply

  • YING JANG LIN avatar

    Posted on Apr 21, 2010 (permalink)

    Hello,Vassil


    I have attahed sample file and programming.
    .
    1, I have found document without set sub group size and location and sub group item fit group size 

    2, How to separate set group font size,sub group font size and sub group item font size


    Thanks

    YJ  

    Reply

  • Nikolay Nikolay admin's avatar

    Posted on Apr 27, 2010 (permalink)

    Hi YING JANG LIN,

    Please note that you are only allowed to attach images to the forum messages. This may be the reason why I cannot notice any attachments to your latest response.

    1. Please refer to our Examples application, section PanelBar >> Nested PanelBars. This examples demonstrates how to nest RadPanelBars into each other.
    2. In order to set the font of a group, let's say RadPanelBarGroupElement1, please consider the following code snippet:
    RadPanelBarVisualElement captionElement = this.radPanelBarGroupElement1.GetCaptionElement();
    captionElement.Font = new Font("Comic Sans Serif", 12, FontStyle.Strikeout);

    As to the font of the group items, assuming that your items are contained in RadPanelBarGroupElement1, follow the approach demonstrated below:
    Font font = new Font("Comic Sans Serif", 12, FontStyle.Strikeout);
    for (int i = 0; i < this.radPanelBarGroupElement1.Items.Count; i++)
    {
         this.radPanelBarGroupElement1.Items[i].Font = font;
    }


    Sincerely yours,
    Nikolay
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Panelbar (obsolete as of Q2 2010) > add dynamic labels to radPanelbarGroupElement.ContentPanel
Related resources for "add dynamic labels to radPanelbarGroupElement.ContentPanel"

[ Features | Demos | Documentation | Knowledge Base | Telerik TV | Code Library | Step-by-step Tutorial | Blogs | Self-Paced Trainer ]