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

WPF and Desktop Alert

15 Answers 298 Views
DesktopAlert
This is a migrated thread and some comments may be shown as answers.
Clément
Top achievements
Rank 1
Clément asked on 25 Jul 2015, 08:02 PM

Hi, 

 

 

I'm new to Telerik and I use a trial version of telerik devcraft.

I'd like to use a Desktop Alert in VB.Net and WPF but I don't know how, and I don't find any documentation for it. Can you explain me how to use it ?

 

 

Thanks,

Clément.

15 Answers, 1 is accepted

Sort by
0
Clément
Top achievements
Rank 1
answered on 26 Jul 2015, 12:02 PM
PS : I'm using VS2015
0
Kalin
Telerik team
answered on 28 Jul 2015, 08:58 AM
Hi Clément,

In order to show a DesktopAlert, you would need firstly to create an instance of RadDesktopAlertManager:

Dim manager = New RadDesktopAlertManager()

And then using its ShowAlert method to show the alert:

Dim alert = New RadDesktopAlert() With {
    Key .Header = "MAIL NOTIFICATION",
    Key .Content = "Hello, Here are two things that we noticed today on our daily meeting.",
    Key .Command = New DelegateCommand(OnCommandExecuted),
    Key .ShowDuration = 5000
}
manager.ShowAlert(alert)

For details regarding the control, you can check the DesktopAlert online documentation on the following link:
http://docs.telerik.com/devtools/wpf/controls/raddesktopalert/getting-started

Hope this helps.

Regards,
Kalin
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
Clément
Top achievements
Rank 1
answered on 28 Jul 2015, 04:15 PM

Thanks Kalin, I have to others questions : is this possible to manage the opacity of the alert ? 

alert.opacity = 75 for exemple isn't working

And is this possible to change the animation to make the alert appear by a slide up or slide down ? 

Thanks,

Clément

0
Kalin
Telerik team
answered on 29 Jul 2015, 06:43 AM
Hi Clément,

The Opacity property works with values from 0 to 1, so try setting it in that range the see result. However with the current implementation this would be only initially applied - when you mouse enter and then mouse leave the control the opacity would be set to 0.9. This done from a StoryBoard named DesktopAlertOnMouseLeave inside of the DesktopAlert Styles - you can modify it there as per your needs.

As for the other question you can check the following article from our help documentation that explains how to change the Show/Hide animation either with single or multiple ones:
http://docs.telerik.com/devtools/wpf/controls/raddesktopalert/how-to/apply-multiple-animations-for-showing-and-hiding-raddesktopalert

You can also check this demo from our XAML SDK Repository:
https://github.com/telerik/xaml-sdk/tree/master/DesktopAlert/ShowingAndHidingUsingAnimationGroup

As well as you can check the Configurator DesktopAlert example in our WPF Demos where more different animations are demonstrated:
http://demos.telerik.com/wpf/

Hope this helps.

Regards,
Kalin
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
Clément
Top achievements
Rank 1
answered on 29 Jul 2015, 08:58 AM

Is there anything else to import than Telerik.Windows.Controls ?

Because if I do :

        Dim alert = New RadDesktopAlert
        alert.Header = "Header"
        alert.Content = "Content"
        alert.ShowDuration = 6000
        Dim manager = New RadDesktopAlertManager(AlertScreenPosition.TopRight, New System.Windows.Point(-5, 5))
        manager.ShowAnimation = New FadeAnimation() With
{
    Key.Direction = AnimationDirection.Out,
    Key.MinOpacity = 0.5,
    Key.MaxOpacity = 0.9,
    Key.SpeedRatio = 0.5
}
        manager.ShowAlert(alert)

the part "manager.ShowAnimation(...)" isn't working (FadeAnimation isn't declared and I have 4 errors like this : "Name of field or property being initialized in an object initializer must start with '.'")


 
0
Clément
Top achievements
Rank 1
answered on 29 Jul 2015, 10:10 AM

EDIT : Solved by removing "key"

 

There is my last question : How to set alert Icon ? I tried :

alert.Icon = New BitmapImage() With {.UriSource = New Uri("pack://application:,,,/questions1.png")}

But it's not working (there is no icon when the alert is shown) and code you provide in support is not working too  


 
0
Kalin
Telerik team
answered on 30 Jul 2015, 08:50 AM
Hi Clément,

When setting the Icon you would need to also set the IconColumnWidth property with the desired size reserved for the icon. You can also check the IconMargin property for more precise aligning the icon of RadDesktopAlert.

Hope this helps.

Regards,
Kalin
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
naga
Top achievements
Rank 1
answered on 27 Jun 2019, 11:31 AM

Hi,

 

I'm unable to see the desktop notification on using below code in a simple WPF application.

 

private void Button_Click(object sender, RoutedEventArgs e)
        {
            MessageBox.Show("You clicked me");
            var alert = new RadDesktopAlert();
            alert.Header = "MAIL NOTIFICATION";
            alert.Content = "Hello, Here are two things that we noticed today on our daily meeting.";
            alert.ShowDuration = 30000;
            alert.Opacity = 75;

            RadDesktopAlertManager manager = new RadDesktopAlertManager(AlertScreenPosition.BottomRight);
            manager.ShowAlert(alert);
        }

 

This code executes on click of a button in a simple WPF App.

 

I use Win 10 machine, with .net framework 4.7.2 and VS 2017. 

 

Can someone please help?

 

Regards,

Naga

0
Dimitar Dinev
Telerik team
answered on 28 Jun 2019, 01:30 PM
Hi Naga,

Thank you for the code snippet.

I tested it on the enviroment you described and it worked as expected. However, one possible scenario might be if you're using NoXaml binaries and the resources of the theme aren't merged on Application level i.e App.xaml.

Can you please confirm if this is the case? For your convenience, I've prepared a small sample project that demonstrates how to use RadDesktopAlert using NoXaml, which you can find attached. Please, review and if necessary, update it with your logic and send it back to me, so I can further investigate. 

Regards,
Dimitar Dinev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
sampath kumar
Top achievements
Rank 1
answered on 01 Jul 2019, 09:02 AM

Thanks Dimitar !!

In case of NoXaml dlls

working : if resources are in app.xaml file and when i use MainWindow.xaml as startup page

not working : if resources are in user control and user control is being used in MainWindow.xaml

 

I would like to see the alerts from user control in which resources are included

 

 

 

 

0
Dimitar Dinev
Telerik team
answered on 02 Jul 2019, 12:38 PM
Hi Sampath,

The RadDesktopAlert is hosted in a separate WPF Window, so it can't access the merged styles in another Window (the UserControl in the MainWindow). However there are two options I can suggest you in order to be able to style the RadDesktopAlert using NoXaml. The first is, as mentioned, to merge the resources in App.xaml and the other is to merge the resources into the control itself as shown below:

private void Button_Click(object sender, RoutedEventArgs e)
{
    var alert = new RadDesktopAlert
    {
        Header = "MAIL NOTIFICATION",
        Content = "Hello, Here are two things that we noticed today on our daily meeting.",
        ShowDuration = 5000
    };
  
    alert.Resources.MergedDictionaries.Add(new ResourceDictionary()
    {
        Source = new Uri("/Telerik.Windows.Themes.Office_Black;component/Themes/System.Windows.xaml", UriKind.RelativeOrAbsolute)
    });
    alert.Resources.MergedDictionaries.Add(new ResourceDictionary()
    {
        Source = new Uri("/Telerik.Windows.Themes.Office_Black;component/Themes/Telerik.Windows.Controls.xaml", UriKind.RelativeOrAbsolute)
    });
    alert.Resources.MergedDictionaries.Add(new ResourceDictionary()
    {
        Source = new Uri("/Telerik.Windows.Themes.Office_Black;component/Themes/Telerik.Windows.Controls.Navigation.xaml", UriKind.RelativeOrAbsolute)
    });
      
    manager.ShowAlert(alert);
}

Please, let me know if this helps.

Regards,
Dimitar Dinev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
naga
Top achievements
Rank 1
answered on 03 Jul 2019, 04:45 AM

Hi Dimitar,

 

Thanks for your reply. It worked for us. Thanks for your help.

 

Regards,

Naga

0
Dawid
Top achievements
Rank 1
answered on 19 Dec 2019, 12:34 PM

Hi Dimitar

I tried following the suggestions, but something is still not quite right.

I have the following code:

    RadDesktopAlertManager testManager = new RadDesktopAlertManager(AlertScreenPosition.BottomRight);
                RadDesktopAlert testAlert = new RadDesktopAlert();

                testAlert.Resources.MergedDictionaries.Add(new ResourceDictionary()
                {
                    Source = new Uri("/Telerik.Windows.Themes.VisualStudio2013;component/Themes/System.Windows.xaml", UriKind.RelativeOrAbsolute)
                });
                testAlert.Resources.MergedDictionaries.Add(new ResourceDictionary()
                {
                    Source = new Uri("/Telerik.Windows.Themes.VisualStudio2013;component/Themes/Telerik.Windows.Controls.xaml", UriKind.RelativeOrAbsolute)
                });
                testAlert.Resources.MergedDictionaries.Add(new ResourceDictionary()
                {
                    Source = new Uri("/Telerik.Windows.Themes.VisualStudio2013;component/Themes/Telerik.Windows.Controls.Navigation.xaml", UriKind.RelativeOrAbsolute)
                });
                testManager.ShowAnimation = new FadeAnimation { SpeedRatio = 20 };
                testManager.HideAnimation = new FadeAnimation { SpeedRatio = 20 };
                testAlert.Style = null;
                testAlert.ShowDuration = 3000;
                testAlert.BorderThickness = new Thickness(0);
                testAlert.Background = Brushes.Black;
                testAlert.Foreground = Brushes.White;

                testAlert.Content = "Testing123";
                testManager.ShowAlert(testAlert);

If i tab out i can see there is a "hidden" window but it does not seem to have any content or styles.

Your help would be appreciated.

Kind Regards

Dawid

0
Lance | Manager Technical Support
Telerik team
answered on 19 Dec 2019, 08:07 PM

Hello Dawid,

I've replied to your Support Ticket with the reason for the problem, I wanted to follow up here in case it is helpful to someone in the community.

The reason for the missing styling is because testAlert.Style is set to null. When that line is commented out (or deleted), you will see the following alert:

Regards,
Lance | Team Lead - US DevTools Support
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Dawid
Top achievements
Rank 1
answered on 20 Dec 2019, 06:18 AM
Hi Lance

Thank you this was indeed the issue.

Thank you for the quick response!
Tags
DesktopAlert
Asked by
Clément
Top achievements
Rank 1
Answers by
Clément
Top achievements
Rank 1
Kalin
Telerik team
naga
Top achievements
Rank 1
Dimitar Dinev
Telerik team
sampath kumar
Top achievements
Rank 1
Dawid
Top achievements
Rank 1
Lance | Manager Technical Support
Telerik team
Share this question
or