I would like to know whether anyone else is facing the same issue like mine.
I'm using RadDesktopAlert on Visual Studio 2008 (C#), and I never set any button to trigger the desktop alert.
I'm calling it whenever I want to display the alert.
I leave the FixedSize value to its default 0, 0 (which should resize automatically according to the content text set.
However, I noticed that's not the case, they will always put in the text to fit the "fixed" size, after that, the remaining text exceeded the alert window size would be replaced with "..." at the bottom of the displayed text.
May I know whether this is a bug or some settings issue?
8 Answers, 1 is accepted
For example, this is the formatting I put for ContentText
Which I will pass to a private function ShowDesktopAlert(string, string);
But it's displayed incompletely. It would only displayed up to the first <br>.
Thank you for contacting us.
Currently, RadDesktopAlert does not support AutoSize. However, you can measure the text you want to display before you open the alert and then set its FixedSize property. The following sample demonstrates this:
Note that the above method will work with plain text only. If you need to use HTML-like formatted text, then the approach would be slightly different.
I hope this will help you. Please let me know if you have any additional questions.
the Telerik team
Thanks for your reply. May I know how should I achieve this if I want to use HTML-like formatted text? (As shown in the code I've pasted in my first post).
As plain text is good if I only want to display a short and sweet message.
Btw, any plan from Telerik to enable the AutoSize of FixedSize value?
Here is how you can measure the text when you also have some HTML-like formatting:
This solution should also work if the text is plain.
As to adding AutoSize support to RadDesktopAlert, no, we currently do not have plans or time frames for adding such a feature. However, this feature sound reasonable and therefore I have logged it in our Public Issue Tracking System as a feature request. Here is the link to the PITS item. You can subscribe to it to track if for changes or vote for it to increase its priority.
Your Telerik points have been updated. Feel free to ask if you have any future questions.
the Telerik team
Thanks for the helps and efforts.
I would love to see this features coming out, but so far no one has voted for it yet. I've just cast my vote for this.
I commented there that there should be a restriction on the maximum of characters to be allowed in RadDesktopAlert ContentText, otherwise, people might abuse the flexibility and blow up the Alert to fill the whole screen, which definitely defeat the purpose of using a RadDesktopAlert, unless that's one of the flexibility Telerik would like to give the rights back to developers to decide how they want to use their Telerik controls :-)
The PITS item was created at the moment I wrote my previous post so not having any votes is pretty normal. Thank you very much for your feedback. We really appreciate that you have shared it with us.
Should you have any future questions, do not hesitate to contact us.
the Telerik team
Dim Reminder As New RadDesktopAlert
Reminder = New RadDesktopAlert
Reminder.ShowPinButton = False
Reminder.ShowOptionsButton = False
Reminder.FixedSize = New System.Drawing.Size(330, 330)
Reminder.Popup.Opacity = 1
Reminder.Popup.AlertElement.ButtonsPanel.Visibility = ElementVisibility.Collapsed
Reminder.Popup.AlertElement.CaptionElement.Visibility = ElementVisibility.Collapsed
Reminder.Popup.BackColor = Color.Transparent
Reminder.Popup.AlertElement.BackColor = backcolor
Reminder.Popup.AlertElement.BorderColor = backcolor
Reminder.Popup.AlertElement.ForeColor = backcolor
Reminder.Popup.AlertElement.NumberOfColors = 1
Reminder.Popup.AlertElement.GradientStyle = GradientStyles.Solid
Reminder.Popup.AlertElement.Shape = New RoundRectShape(8)
Dim dockPanel As DockLayoutPanel = New DockLayoutPanel()
dockPanel.LastChildFill = True
dockPanel.StretchHorizontally = True
Dim imageElement As LightVisualElement = New LightVisualElement()
imageElement.Image = icon
imageElement.ImageLayout = ImageLayout.Center
imageElement.Margin = New System.Windows.Forms.Padding(5, 0, 0, 0)
Dim textElement As RadLabelElement = New RadLabelElement()
textElement.Text = value
textElement.ForeColor = Color.White
textElement.StretchHorizontally = True
textElement.TextAlignment = ContentAlignment.MiddleLeft
textElement.Margin = New System.Windows.Forms.Padding(10, 0, 0, 0)
Reminder.Popup.AlertElement.ContentElement.TextAlignment = ContentAlignment.MiddleLeft
Reminder.Popup.AlertElement.ContentElement.ImageAlignment = ContentAlignment.MiddleLeft
Reminder.ScreenPosition = AlertScreenPosition.Manual
Reminder.AutoCloseDelay = AutoCloseDelay
Reminder.PopupAnimation = False
Dim alertElement As RadDesktopAlertElement = TryCast((CType(Reminder.Popup, DesktopAlertPopup)).RootElement.Children(0), RadDesktopAlertElement)
alertElement.ContentElement.Measure(New SizeF(Reminder.FixedSize.Width, Single.PositiveInfinity))
Reminder.FixedSize = New Size(Reminder.FixedSize.Width, CInt(alertElement.ContentElement.DesiredSize.Height) + 20)
Reminder.Popup.Location = New Point((Screen.PrimaryScreen.WorkingArea.Width / 2) - (Reminder.FixedSize.Width / 2), 125)
Catch ex As Exception
Thank you for sharing your solution with the community.
Since this is a very old forum post, I would like to note that since R1 2017 RadDesktopAlert supports auto sizing. Hence, if the AutoSize property is set to true and the alert's content requires more space, RadDesktopAlert will be automatically resized to fit the text.
I hope this information helps. If you need any further assistance please don't hesitate to contact me.
Dess | Tech Support Engineer, Sr.
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.