Show RadDesktopAlert on active screen

2 Answers 70 Views
DesktopAlert
Zygmunt
Top achievements
Rank 1
Iron
Iron
Iron
Zygmunt asked on 27 Mar 2023, 08:25 AM

Hi,

How can I show RadDesktopAlert always on active screen?

2 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 27 Mar 2023, 11:15 AM

Hello, Zygmunt,

Please have a look at the following help article demonstrating how to setup and show a RadDesktopAlert:

https://docs.telerik.com/devtools/winforms/controls/desktopalert/gettingstarted 

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Zygmunt
Top achievements
Rank 1
Iron
Iron
Iron
commented on 27 Mar 2023, 01:34 PM

I use DesktopAlertManager like presented below but alerts always shown on primary screen.


DesktopAlertManager.Instance.SetActiveScreen(DesktopAlertManager.Instance.ActiveScreen);

radDesktopAlert.FixedSize = new System.Drawing.Size(330, 70);
radDesktopAlert.Popup.LoadElementTree();
RadDesktopAlertElement alertElement = ((DesktopAlertPopup)radDesktopAlert.Popup).RootElement.Children[0] as RadDesktopAlertElement;
alertElement.ContentElement.Measure(new SizeF(radDesktopAlert.FixedSize.Width, float.PositiveInfinity));
radDesktopAlert.FixedSize = new Size(radDesktopAlert.FixedSize.Width, (int)alertElement.ContentElement.DesiredSize.Height + 50);

radDesktopAlert.Show();

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 30 Mar 2023, 08:34 AM

Hi, Zygmunt,

The DesktopAlertManager.Instance.ActiveScreen property is initialized with the main monitor (Screen.PrimaryScreen) specified in the Display settings of the operating system. 

It is possible to show the alert considering on which monitor the main form is currently placed. The following code snippet demonstrates a sample approach how to do it. Thus, wherever you move the main form from which the alert is shown, this will be the monitor for showing the alert: 

        private void timer1_Tick(object sender, EventArgs e)
        {
            DesktopAlertManager.Instance.SetActiveScreen(Screen.FromPoint(this.Location));
            this.radDesktopAlert1.CaptionText = "New E-mail Notification";
            this.radDesktopAlert1.ContentText = "Hello Jack, I am writing to inform you " +
                                                "that the planning meeting scheduled for Wednesday has been postponed and" +
                                                "it will eventually be rescheduled, possibly for the next Tuesday";

            radDesktopAlert1.Show();
        }

Please give it a try and see how it works on your end. Would this approach be suitable for your scenario? If not, it would be greatly appreciated if you can share more details about the exact goal that you are trying to achieve. Thus, we would be able to think about an appropriate solution.

I hope this information helps.

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

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