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

MVVM bind to content rendered event

1 Answer 135 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Anne asked on 28 Dec 2020, 07:16 PM

We have a need to execute some command when the window is fully loaded. In order to do that we want to be able to bind event ContentRendered to the command in view model.

What would be the best way to achieve this? As I understood there are three approaches:

- resolving view model from the condebehind and invoking the command

- interactivity library (additional dependancy)

- a combination of attached property and attached behavior


What is a recommended way to bind to the window event in MVVM style? Is there a code sample somewhere to take a look at?


Thank you.

1 Answer, 1 is accepted

Sort by
Martin Ivanov
Telerik team
answered on 30 Dec 2020, 03:15 PM

Hello Anne,

Indeed, the approaches you listed are the ones usually suggested. In general all of those approaches are suitable and I cannot tell that there is a recommended one. It all depends on the project's requirements and the developer preferences. I would go with the "interactivity library" one because the Telerik UI for WPF suite already provides an extensions for this (EventToCommandBehavior), and also because it is the most clean solution. 

<Window x:Class="WpfApp8.MainWindow"
        Title="MainWindow" Height="450" Width="800">  
        <telerik:EventBinding EventName="ContentRendered" Command="{Binding MyCommand}" />

I hope that helps.

Martin Ivanov
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

Asked by
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question