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

Overriding or removing an event?

1 Answer 291 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Alex
Top achievements
Rank 1
Alex asked on 23 Sep 2016, 08:19 PM

I'm trying to override or remove the ability to click directly on the content of a DesktopAlert. My problem is that when you set the alert's content to a plain string, it acts as a link-button and upon clicking the text, it will close the window. This is a problem since there are certain DesktopAlerts that I don't want to be closed at all. I can set it as Enabled = False but then the dropdown menu and other parts of the alert quit functioning. This is all created from code behind so it is a little harder for me to set any properties or templates for it in XAML. I thought perhaps I should post in this forum and see if there is a way to not only remove the ability to click the content, but also to remove/override events in code-behind in general for WPF controls created server-side.

Dim mainAlert = New RadDesktopAlert() With {
    .Header = "Messages",
    .Content = "You have " & unreadCount & " new messages",
    .Height = 75,
    .Width = 300,
    .IconTemplate = TryCast(Application.Current.FindResource("radIconTemplate"), DataTemplate),
    .IconColumnWidth = 30,
    .IconMargin = New Thickness(5, 10, 15, 0),
    .CanAutoClose = False,
    .ShowCloseButton = False,
    .Tag = "main",
    .ShowMenuButton = True,
    .MenuItemsSource = GetDesktopAlertMenuItems
}
manager.ShowAlert(mainAlert)

1 Answer, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 26 Sep 2016, 08:12 AM
Hello Alex,

We have noticed that you have asked the exact same question here. Please, check the provided answer there.

As for your question concerning the events. In order to handle events that already been handled by the control and execute some logic in that event you could use the RegisterClassHandler method of the EventManager class - thus events that are already handled by the control will be raised as expected.

We hope this will help you.

Regards,
Nasko
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
General Discussions
Asked by
Alex
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Share this question
or