Ticket T646706
Visible to All Users

Grid - How to create a Context Menu for rows and cells

created 7 years ago

Hi Support Team,

I want to add a context menu to dxg:GridControl row. Context menu should contain one text box and two buttons (Ok, Cancel). I want to implement this in MVVM way.

Please let me know how to achieve this context menu feature for each row click of Grid. I need this for each row since I have update particular row cell on Ok click.

Thanks,
Sourav

Comments (2)
DevExpress Support Team 7 years ago

    Hello Sourav,

    The editing functionality you're describing looks similar to the GridControl's built-in Edit Form feature. Please take a moment to test this built-in feature and let me know if it meets your requirements. I look forward to your reply.

    Thanks,
    Michael

    S S
    Sourav C Parida 7 years ago

      Hi Michael

      Your proposed is similar but not the exactly matching my requirement.

      1. The popup dialog shows on double click. I need the popup dialog on right click not on double click
      2. The popup dialog now contains all the columns of the grid. I need custom text box which is not  part of grid column itself.
      3. The popup dialog now contains update/cancel button. I need Ok Cancel button.

      Thanks,
      Sourav

      Answers approved by DevExpress Support

      created 7 years ago

      Hello Sourav,
      Thank you for the clarification.
      Our grid provides an easy way to customize context menus. You need to build your own menu using the DataViewBase.RowCellMenuCustomizations property. Please see the Context Menus help topic for more information.

      Drop me a line if you have any further questions.

        Show previous comments (1)
        Andrew Ser (DevExpress Support) 7 years ago

          Hello Sourav,
          I'm afraid that your final goal is still unclear to me. Initially you were discussing the Context Menu but now you are talking about both the Context Menu and a dialog. The Context Menu and the dialog are different UI elements. The Context Menu is a list of actions and labels while the dialog is a separate Window which blocks the main window while opened. You can see examples of Context Menus in the Context Menus help topic.

          Please clarify whether you need to show a Context Menu with a TextBox and two buttons or a separate dialog with a TextBox and two buttons when you right click a grid row? What do you want to do with this TextBox?

          S S
          Sourav C Parida 7 years ago

            Hi Andrew,

            I need a separate dialog with a TextBox and two buttons when you right click a grid row. I know this can be achieve by creating a usercontrol and displaying it. but is there a way in built a way in devexpress which I can reuse.

            Thanks,
            Sourav

            Andrew Ser (DevExpress Support) 7 years ago

              Hi Sourav,
              Thank you for the clarification.
              Our Edit Form isn't intended to be used in this way. It will be much easier to show a separate window instead of customizing Edit Form.
              I've prepared a simple project demonstrating how to do this. Please take a note on the GridControl_PreviewMouseDown method. It illustrates how to show the dialog and obtain a row you clicked.

              Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

              Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.