This is a migrated thread and some comments may be shown as answers.

RadButtonElement Covers ContentImage

2 Answers 83 Views
DesktopAlert
This is a migrated thread and some comments may be shown as answers.
Ryan
Top achievements
Rank 1
Ryan asked on 04 Jan 2016, 05:00 PM
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 Answers, 1 is accepted

Sort by
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 06 Jan 2016, 09:25 AM
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
0
Ryan
Top achievements
Rank 1
answered on 06 Jan 2016, 03:11 PM

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.

Tags
DesktopAlert
Asked by
Ryan
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Ryan
Top achievements
Rank 1
Share this question
or