RadButtonElement Covers ContentImage

3 posts, 1 answers
  1. Ryan
    Ryan avatar
    35 posts
    Member since:
    Jul 2015

    Posted 04 Jan Link to this post

    Hello,

    When I add a RadButtonElement to my alert, it causes the ContentImage to be cut off at the top of the button element, despite the button being on the other side of the alert. See the attached images as an example.

    Is there a BringToFront event (or something along those lines) for ContentImage?

    Thanks!
  2. Answer
    Dess
    Admin
    Dess avatar
    1601 posts

    Posted 06 Jan Link to this post

    Hello Ryan,

    Thank you for writing.

    It seems that the RadButtonElement is stretched horizontally. That is why it covers the content image. You should set the StretchHorizontally property to false and specify the MaxSize of the button. Additionally, you can set the PositionOffset property to place the RadButtonElement at the desired location:
    RadButtonElement button = new RadButtonElement();
    RadDesktopAlert radDesktopAlert1 = new RadDesktopAlert();
     
    public Form1()
    {
        InitializeComponent();
        button.MinSize = button.MaxSize = new Size(130, 20);
        button.Text = "Open System Monitor";
        button.StretchHorizontally = false;
        button.PositionOffset = new SizeF(150, 20);
        button.ButtonFillElement.BackColor = Color.Aqua;
        button.ButtonFillElement.GradientStyle = Telerik.WinControls.GradientStyles.Solid;
        radDesktopAlert1.Popup.AlertElement.ContentElement.Children.Add(button);
    }
     
    private void radButton1_Click(object sender, EventArgs e)
    {
        radDesktopAlert1.ContentImage = Properties.Resources.about_paint;       
        radDesktopAlert1.CaptionText = "New E-mail Notification";
        radDesktopAlert1.ContentText = DateTime.Now.ToLongDateString();
        radDesktopAlert1.Show();
    }

    I hope this information helps. Should you have further questions I would be glad to help.
     
    Regards,
    Dess
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Ryan
    Ryan avatar
    35 posts
    Member since:
    Jul 2015

    Posted 06 Jan in reply to Dess Link to this post

    Thanks Dess! I would have never figured that out.

    The real reason for this happening was due to me using:

    RadDesktopAlert1.ButtonItems.Add(btn)

    Rather than (the code you provided):

    RadDesktopAlert1.Popup.AlertElement.ContentElement.Children.Add(btn)

    And as you mentioned, I also had to set the MaxSize property after changing my code to this.

Back to Top