© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
53 replies
Indeed

❔ WPF multiple data contexts

Hi!
In my wpf app i need to have view-specific commands but i am already using my separate ViewModel (MVVM) as a data context? How can I achieve it wanting a button do something view-specific but also something on the model?

<Button>
    <i:Interaction.Triggers>
        <i:EventTrigger EventName="Click">
            <i:InvokeCommandAction Command="{Binding ViewModelCommand}" />
            <i:InvokeCommandAction Command="{Binding ViewCommand}" /> //
        </i:EventTrigger>
    </i:Interaction.Triggers>
</Button>
<Button>
    <i:Interaction.Triggers>
        <i:EventTrigger EventName="Click">
            <i:InvokeCommandAction Command="{Binding ViewModelCommand}" />
            <i:InvokeCommandAction Command="{Binding ViewCommand}" /> //
        </i:EventTrigger>
    </i:Interaction.Triggers>
</Button>
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements
Next page

Similar Threads

❔ WPF data binding
C#CC# / help
3y ago
WPF Navigationservices transfer data
C#CC# / help
4y ago
❔ WPF MVVM multiple views problem
C#CC# / help
3y ago