Click here to Skip to main content
15,867,568 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a WPF usercontrol and made a model / viewmodel

In the viewmodel is a lot of code for the menuitems / ribbonbuttons.

Only this is in the code behind of the usercontrol:

VB
#Region " RibbonEvents"
     Private Sub RibbonWPF_MouseDoubleClick(sender As Object, e As Windows.RoutedEventArgs) Handles RibbonWPF.MouseDoubleClick

        If RibbonWPF.IsMinimized = True Then
            '_RibbonSizeIsMinimized = True
            cRibbonPropsVM.RibbonSizeIsMinimized = True
            AppForm.UserControlWPFisMinimized = True
        Else
            '_RibbonSizeIsMinimized = False
            cRibbonPropsVM.RibbonSizeIsMinimized = False
            AppForm.UserControlWPFisMinimized = False
        End If

    End Sub

    Private Sub UserControlRibbonWPF_ContextMenuClosing(sender As Object, e As EventArgs) Handles Me.ContextMenuClosing

        AppForm.UserControlWPFisMinimized = RibbonWPF.IsMinimized

        'RibbonSizeIsMinimized = RibbonWPF.IsMinimized
        cRibbonPropsVM.RibbonSizeIsMinimized = RibbonWPF.IsMinimized
        'MsgBox(cRibbonPropsVM.RibbonSizeIsMinimized.ToString)

    End Sub

  #End Region


What I have tried:

I found no way to handle events from #Region " RibbonEvents" in the viewmodel.

How to do that or should that stay as code behind?
Posted
Comments
Jo_vb.net 11-Jan-22 7:50am    
Just found out that NuGet package MVVMLight solves my issue.

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