Click here to Skip to main content
15,878,048 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have used the following code to turn the UI event into a command:

        <i:EventTrigger EventName="OnDemandLoading" SourceObject="{Binding ElementName=dataPager}">
            <i:InvokeCommandAction Command="{Binding DataGridContext}" PassEventArgsToCommand="True"/>

It can run a method in ViewModel when the related event is raised. I need to have access to all methods of control. For example, dataPager has a method called LoadDynamicItems() and I want to access it in ViewModel. How is this possible?

What I have tried:

I have no idea about solving this problem.
Richard Deeming 5-Aug-22 8:50am    
If you want access to all methods of a control from your view-model, then you're doing MVVM wrong.

The view-model should not have any knowledge of the view. It's simply used to adapt the model into a suitable shape to be bound to the view.

Patterns - WPF Apps With The Model-View-ViewModel Design Pattern | Microsoft Docs[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900