Is there a way to add a button on a PanelBarGroupElement and control its visibility.

5 posts, 0 answers
  1. Khizar Khan
    Khizar Khan avatar
    41 posts
    Member since:
    Jan 2010

    Posted 02 Feb 2010 Link to this post


    I have 10 panelbargroupelements and when the mouse is hovering on each of them there should a button visible and enabled to click, otherwise it should not be visible.

    also, on click of the button I want to get which groupelement was clicked.
    thanks for your help in advance.

    Regards,
    khizar
  2. Martin Vasilev
    Admin
    Martin Vasilev avatar
    1061 posts

    Posted 05 Feb 2010 Link to this post

    Hi Khizar Khan,

    Thank you for writing.

    RadPanelBar does not support adding buttons into group captions out of the box. However, you can implement this feature using the hierarchy of RadElements. I have prepared a small sample application that demonstrates this approach. Please, find it as an attachment to this message. Let me know if you have any additional questions.

    Regards,
    Martin Vasilev
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Khizar Khan
    Khizar Khan avatar
    41 posts
    Member since:
    Jan 2010

    Posted 08 Feb 2010 Link to this post

    Thanks a lot for a very quick reply.

    It has solved my problem.

    Regards,
    Khizar
  5. Khizar Khan
    Khizar Khan avatar
    41 posts
    Member since:
    Jan 2010

    Posted 15 Feb 2010 Link to this post

    Hi,

     I now want to convert the panelbargroupelement as a hyperlink when mouse is entered and as button when leaves...
    any suggestions?

    Regards,
    Khizar
  6. Martin Vasilev
    Admin
    Martin Vasilev avatar
    1061 posts

    Posted 18 Feb 2010 Link to this post

    Hi Khizar Khan,

    I am not sure if I understand your requirement very well, but RadPanelBar does not supports hipper link text out of the box. However, you can make the text underlined and use Hand cursor to mimicry hiper-link:

    Font _fontPrototype;
      
    void SubscribeEvents()
    {
        this.radPanelBar1.LoadElementTree();
        int i = 0;
      
        foreach (RadPanelBarGroupElement element in this.radPanelBar1.Items)
        {
            element.Caption = String.Format("Group {0}", i++);
            RadPanelBarVisualElement visualElement = element.GetCaptionElement();
            if (_fontPrototype == null)
            {
                _fontPrototype = visualElement.Font;
            }
      
            visualElement.MouseEnter+=new EventHandler(visual_MouseEnter);
            visualElement.MouseLeave+=new EventHandler(visual_MouseLeave);
        }
    }
      
    void visual_MouseLeave(object sender, EventArgs e)
    {
        RadPanelBarVisualElement visualElement = (RadPanelBarVisualElement)sender;
        visualElement.Font = _fontPrototype;
        this.Cursor = Cursors.Default;
    }
      
    void visual_MouseEnter(object sender, EventArgs e)
    {
        RadPanelBarVisualElement visualElement = (RadPanelBarVisualElement)sender;
        visualElement.Font = new Font(_fontPrototype, FontStyle.Underline);
        this.Cursor = Cursors.Hand;
    }

    Let me know if you need additional assistance.

    Regards,
    Martin Vasilev
    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.
Back to Top
UI for WinForms is Visual Studio 2017 Ready