Telerik Forums
UI for WPF Forum
1 answer
144 views
hello
I used desktop alert. The height of my desktop alerts is different, and the sum of their height is sometimes higher than the height of the monitor. User closes Desktop Alert 
 And then it scrolls automatically and the rest is displayed. 
1. How can I find out which Desktop Alert is being viewed by the user on the monitor and which Desktop Alert is not visible due to the large number of Desktop Alerts? Sometimes I want to close all the desktop alerts that the user sees on the monitor so that the rest is displayed, and so on.
2. If the number of desktop alerts is large and their total height is greater than the height of the monitor, is it possible to display the scroll so that the user can see the entire desktop alert by scrolling?
Martin Ivanov
Telerik team
 answered on 03 Oct 2024
2 answers
229 views

I am attempting to use the desktop alert but instead of reacting to a click on the content I want a button.  How do I route this?

View Model Method; show the alert (works)

        private void ShowAlert()
        {
            if (IsShowAlert &&
                AlertTitle.IsNotNullOrEmpty() &&
                AlertText.IsNotNullOrEmpty())
            {
                // Create a new BitmapImage
                BitmapImage bitmap = new BitmapImage();
                bitmap.BeginInit();
                bitmap.UriSource = new Uri("pack://application:,,,/Images/GSI_Cloud_256.ico");
                bitmap.EndInit();

                var image = new System.Windows.Controls.Image() { Source = bitmap };

                desktopAlertManager.ShowAlert(new DesktopAlertParameters
                {
                    Header = AlertTitle,
                    Content = AlertText,
                    Icon = image,
                    IconColumnWidth = 48,
                    IconMargin = new Thickness(10, 0, 20, 0),
                    ShowDuration = AlertShowDuration,
                    Command = new DelegateCommand(OnAlertCommandExecuted)
                });
            }
        }

 
Respond to the Button Press:
        private void OnAlertCommandExecuted(object param)
        {
            IsShowTrayApp = true;
        }

Alert Style with a Button:

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:telerikNavigation="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation">

    <SolidColorBrush x:Key="DesktopAlert_BorderBrush" Color="#FF848484"/>
    <LinearGradientBrush x:Key="DesktopAlert_Background" EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="Cornsilk" Offset="0"/>
        <GradientStop Color="#FFD4D4D4" Offset="1"/>
    </LinearGradientBrush>
    <SolidColorBrush x:Key="DesktopAlert_InnerBorderBrush" Color="#FFFFFFFF"/>
    <CornerRadius x:Key="DesktopAlert_CornerRadius">1</CornerRadius>
    <SolidColorBrush x:Key="DesktopAlert_ButtonIconStroke" Color="#FFFFFFFF"/>
    <LinearGradientBrush x:Key="DesktopAlert_ButtonIconFill" EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="#FF282828"/>
        <GradientStop Color="#FF7C7C7C" Offset="1"/>
    </LinearGradientBrush>

    <DataTemplate x:Key="RadDesktopAlertHeaderTemplate">
        <Grid 
            x:Name="Header" 
            Grid.Column="1" 
            Grid.Row="0" 
            VerticalAlignment="Top" 
            HorizontalAlignment="Stretch"
            Background="{StaticResource ContainerHeaderBackgroundBrush}">

            <StackPanel
                HorizontalAlignment="Left"
                Orientation="Horizontal">

                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="30" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>

                    <Image 
                        RenderOptions.BitmapScalingMode="Fant"
                        Margin="5 0 5 0"
                        Source="/Images/GSI_Cloud_256.ico"/>

                    <Label
                        Grid.Column="1"
                        Foreground="White"
                        FontWeight="SemiBold"
                        FontSize="14"
                        VerticalContentAlignment="Center"
                        VerticalAlignment="Center"/>
                </Grid>
                
            </StackPanel>

            <StackPanel
                HorizontalAlignment="Right"
                Orientation="Horizontal">

                <Button Height="30" Width="30"  
	                x:Name="DesktopAlert_CloseButton" 
                    Content="🗙"
                    Background="Transparent"
                    BorderThickness="0"
                    Foreground="White"
                    FontSize="20"
                    Margin="0 -3 0 0"
                    FontWeight="Bold"
                    Command="{x:Static telerikNavigation:DesktopAlertCommands.Close}" />

            </StackPanel>

            <ContentPresenter 
                Content="{Binding}" 
                TextBlock.FontWeight="Bold" 
                Margin="0 0 0 0" 
                MinHeight="{Binding ActualHeight, ElementName=DesktopAlert_CloseButton}" Grid.RowSpan="2" VerticalAlignment="Top">

                <ContentPresenter.Resources>
                    <Style TargetType="{x:Type TextBlock}">
                        <Setter Property="TextWrapping" Value="Wrap"/>
                        <Setter Property="Foreground" Value="White" />
                        <Setter Property="VerticalAlignment" Value="Center" />
                        <Setter Property="HorizontalAlignment" Value="Left" />
                        <Setter Property="Margin" Value="30 0 0 0" />
                    </Style>
                </ContentPresenter.Resources>
            </ContentPresenter>

        </Grid>
    </DataTemplate>

    <ControlTemplate x:Key="RadDesktopAlertTemplate" TargetType="{x:Type telerikNavigation:RadDesktopAlert}">
        <Grid x:Name="LayoutRoot">
            <Border Background="White"
                    BorderThickness="{TemplateBinding BorderThickness}" 
                    CornerRadius="{StaticResource DesktopAlert_CornerRadius}">

                <Border BorderBrush="{StaticResource DesktopAlert_InnerBorderBrush}" BorderThickness="1">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="*"/>
                            <RowDefinition Height="26" />
                        </Grid.RowDefinitions>
                        
                        <ContentPresenter 
                            ContentTemplate="{TemplateBinding HeaderTemplate}" 
                            Grid.Column="1" 
                            Content="{TemplateBinding Header}" 
                            Grid.Row="0" VerticalAlignment="Top"/>

                        <ContentPresenter 
                            x:Name="Content" 
                            Cursor="Hand" 
                            Grid.Column="1" 
                            HorizontalAlignment="Center" 
                            Margin="0 7 0 0" Grid.Row="1" VerticalAlignment="Top">

                            <ContentPresenter.Resources>
                                <Style TargetType="{x:Type TextBlock}">
                                    <Setter Property="TextWrapping" Value="Wrap"/>
                                    <Setter Property="TextTrimming" Value="CharacterEllipsis"/>
                                    <Setter Property="HorizontalAlignment" Value="Center" />
                                    <Setter Property="FontSize" Value="14" />
                                </Style>
                            </ContentPresenter.Resources>
                        </ContentPresenter>

                        <Grid Grid.Row="2">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="126" />
                            </Grid.ColumnDefinitions>

                            <Button
                                Style="{StaticResource ButtonStyle}"
                                Grid.Column="2"
                                Content="Open" 
                                Command="{Binding OnAlertCommandExecuted}"/>
                        </Grid>
                    </Grid>
                </Border>
            </Border>
        </Grid>
    </ControlTemplate>

    <Style TargetType="{x:Type telerikNavigation:RadDesktopAlert}">
        <Setter Property="Padding" Value="10 8"/>
        <Setter Property="Opacity" Value="0.9"/>
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="FontFamily" Value="Segoe UI"/>
        <Setter Property="FontSize" Value="14"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="BorderBrush" Value="{StaticResource DesktopAlert_BorderBrush}"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Width" Value="360"/>
        <Setter Property="Height" Value="130"/>
        <Setter Property="Template" Value="{StaticResource RadDesktopAlertTemplate}"/>
        <Setter Property="HeaderTemplate" Value="{StaticResource RadDesktopAlertHeaderTemplate}"/>
    </Style>
</ResourceDictionary>


 

 

 

Stenly
Telerik team
 answered on 24 May 2024
1 answer
331 views

Hi,

1-How can I implement the following two images in WPF desktop alert?

2-Is it possible to adjust the height automatically based on the content?

Sarah
Top achievements
Rank 1
Iron
 updated answer on 09 Oct 2023
1 answer
173 views

For several years I have been using the RadDesktopAlertManager in my application. Recently I noticed that it has stopped displaying the alert, but without any exceptions.

When I debug, everything works as expected, until I get to the .ShowAlert execution on the manager. Then this happens.

The rest of my code works just fine, and the only thing I am lacking is the alert... but this is of course an application wide outage.

Any ideas... missing a dll?  or....

hhgm
Top achievements
Rank 1
Iron
Iron
Iron
 answered on 04 Oct 2023
0 answers
194 views

Hi,

1-Is it possible to set the RadDesktopAlert height automatically based on the content text?

2-After showing RadDesktopAlert, if we move the mouse over RadDesktopAlert, the background color will change. What should I do if we don't want the background color to change?

3-After RadDesktopAlert is shown, if we move the mouse over RadDesktopAlert, the text of the content will be underlined. What should we do if we don't want this underline to be displayed?

4-After RadDesktopAlert is displayed, if we move the mouse over RadDesktopAlert, a line will be drawn under the content text and RadDesktopAlert will be closed by clicking on the content text. What should I do if RadDesktopAlert is not closed by clicking on the content text?

5-If the Windows theme is in High contrast, it will not be applied to RadDesktopAlert. If we want the background to be black in the contrast theme and the content to be displayed in white, how should we do this?

6-How to change the color of the header & content text?

Thank you

m
Top achievements
Rank 1
Iron
 updated question on 24 Aug 2022
0 answers
198 views

Hi, 

I'm having a problem with RadDesktopAlertManager. I call multiple times high frequency to ShowAlert and CloseAlert, and sometimes a gaps between two consecutive alerts is created.

David
Top achievements
Rank 1
 asked on 12 May 2022
2 answers
257 views

Hi

Can I add hyperlink to desktopalert dynamically?

thank you

m
Top achievements
Rank 1
Iron
 answered on 08 Sep 2021
2 answers
354 views

How can I play a sound in the background when displaying a RadDesktopAlert? I believe the WinForms version has a property to provide a file name and the sound plays automatically.

Martin Ivanov
Telerik team
 answered on 08 May 2020
15 answers
799 views

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.

Dawid
Top achievements
Rank 1
 answered on 20 Dec 2019
3 answers
351 views

Hi All,

I am trying to assign an icon from my resources as follows but no icon is displayed. Can anyone help me please?

P.S. This code works elsewhere where I add the image to a canvas

 

        Dim icon As New Image()
        icon.Height = 80
        icon.Width = 80
        icon.Source = New BitmapImage(New Uri("Resources/monitorNoComms.png", UriKind.Relative))
        alert.Foreground = New SolidColorBrush(Colors.White)
        alert.BorderBrush = New SolidColorBrush(Colors.White)
        alert.Header = header
        alert.Content = message
        alert.IconColumnWidth = 80
        alert.Icon = icon
        alert.CanAutoClose = autoClose
        alert.BorderThickness = New Thickness(1)
        manager.ShowAlert(alert)

 

Vladimir Stoyanov
Telerik team
 answered on 12 Dec 2019
Narrow your results
Selected tags
Tags
GridView
General Discussions
Chart
RichTextBox
Docking
ScheduleView
ChartView
TreeView
Diagram
Map
ComboBox
TreeListView
Window
RibbonView and RibbonWindow
PropertyGrid
DragAndDrop
TabControl
TileView
Carousel
DataForm
PDFViewer
MaskedInput (Numeric, DateTime, Text, Currency)
AutoCompleteBox
DatePicker
Buttons
ListBox
GanttView
PivotGrid
Spreadsheet
Gauges
NumericUpDown
PanelBar
DateTimePicker
DataFilter
Menu
ContextMenu
TimeLine
Calendar
Installer and Visual Studio Extensions
ImageEditor
BusyIndicator
Expander
Slider
TileList
DataPager
PersistenceFramework
Styling
TimeBar
OutlookBar
TransitionControl
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
NavigationView (Hamburger Menu)
Wizard
ExpressionEditor
WatermarkTextBox
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
LayoutControl
ProgressBar
Sparkline
TabbedWindow
ToolTip
CloudUpload
ColorEditor
TreeMap and PivotMap
EntityFrameworkCoreDataSource (.Net Core)
HeatMap
Chat (Conversational UI)
VirtualizingWrapPanel
Calculator
NotifyIcon
TaskBoard
TimeSpanPicker
BulletGraph
Licensing
WebCam
CardView
DataBar
FilePathPicker
Callout
PasswordBox
SplashScreen
Localization
Rating
Accessibility
CollectionNavigator
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
InlineAIAssistant
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?