Completed
Last Updated: 11 Feb 2022 14:44 by ADMIN
Release LIB 2022.1.214 (14 Feb 2022)
Matthias
Created on: 17 Jan 2022 14:03
Category: UI for WPF
Type: Bug Report
0
EventToCommandBehavior: Binding custom events of derived window class throws exception in XAML designer

To whom it may concern,

In our MVVM-project, we are using a derived implementation of the RadRibbonWindow to add some customized functions, for example to add EventHandlers firing when something changed in the view, for example language or culture setting changes from another window. With the EventToCommandBehavior binding, we would like to pass the fired custom event to our view model to execute an async command. Although the event is not shown for autocompletion, everything works fine during runtime, and the command is executed when the event was fired. Unfortunately, the VisualStudio XAML designer cannot bind the custom event handler for the EventToCommand Behavior tag and therefore shows an exception within the XAML code, and within the XAML designer. Because of that binding problem, we are unable to further use the designer to get a preview of our designed windows.

We tried to derive our window from the basic WPF window (System.Windows.Window) and simply add the custom event handler but it did not work, either. Is there any problem with our implementation, or with the EventToCommandBehavior leading to an exception during design time? I have attached a minimal working example. In the code, I have derived a customized window class from the basic WPF window (shows the same error as the RadRibbonWindow), and have added a new event handler. This window is used as main window and fires the custom event when the event OnContentRendered function is called. The view binds this event within XAML to a command of the view model. The command is implemented with our customized asynchronous command. The XAML designer throws the described exception (as shown in the provided picture) but when I debug the program, a break point set within the function called by the command is hit.

I have removed the package "Telerik.Windows.Controls.for.Wpf.Xaml.2021.3.1109" within the .zip-folder because the code would have exceeded the maximum file size.

Sincerely,

Matthias Jörg

3 comments
ADMIN
Dilyan Traykov
Posted on: 24 Jan 2022 14:22

Hello Matthias,

Thank you for testing this out at your end and sharing the results. I have added this information to our internal backlog item and we will keep this in mind when looking for a solution to the issue.

Regards,
Dilyan Traykov
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.

Matthias
Posted on: 18 Jan 2022 11:14

Hello Dilyan,

Thanks for the quick response.

When reporting this bug, I have been using Mircosoft Visual Studio Professional 2019, version 16.11.9, which shows the reported bug. Now, I have downloaded the Visual Studio 2022 version 17.0.5 which you have recommended, and the error in the designer has disappeared leading to show any controls placed correctly. The error is still shown within the XAML code and the error ouput.

I also tried switching back to Visual Studio 2019, version 16.11.9, and the error is shown again. It seems that it is related to the Visual Studio version.

Regards,

Matthias

ADMIN
Dilyan Traykov
Posted on: 18 Jan 2022 10:38

Hello Matthias,

Thank you for bringing this to our attention.

I can confirm that I was also able to replicate this error at my end. Interestingly, however, the designer is still shown on my machine despite the error:

I also tried placing different controls inside the Grid and they are all displayed as expected. For your information, I'm using the 17.0.5 version of Microsoft Visual Studio Professional 2022.

Would you find it possible to test this version out and see if you still observe the issue?

Regards,
Dilyan Traykov
Progress Telerik

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/.