Ticket T381271
Visible to All Users

how to intercept the spreadsheets control "Do you want to replace the contents of the destination cells?" message ?

created 9 years ago

When I drag some cells in the spreadsheet and drop them on other cells that contain a value than this happens :

  1. the dragged cells are put back to their original position
  2. this message appears "Do you want to replace the contents of the destination cells?"
    I added a video to demonstrate this.

How can I intercept this message ?
The dragged cells may be put back to the original position that is no problem but I would like to either skip this message or replace it with my own.

Answers approved by DevExpress Support

created 9 years ago (modified 9 years ago)

Hello Guido,
To display this confirmation window, we use our own MessageBoxService service. You can replace our service with your custom one and show your own message box or skip a predefined one in the IMessageBoxService.ShowOkCancelMessage method.
I have attached a sample project to demonstrate this approach in action. Please check it and let me know whether or not this solution meets your requirements.

    Comments (2)

      I tried disabling the message by doing this
              private void Form1_Load(object sender, EventArgs e) {
                  spreadsheetControl1.RemoveService(typeof(IMessageBoxService));
              }

      but that is not enough, the message still displays.
      Do I really need to create a service to get rid of the service ?

      DevExpress Support Team 9 years ago

        Yes, Guido,
        The most suitable solution for your scenario is to implement a custom service.
        Otherwise, you will need to create a SpreadsheetControl descendant, and override our internal logic and classes, which is not recommended.
        Moreover, the approach with the custom service is quite flexible and can be used to customize different messages shown in the SpreadsheetControl.
        Let me know if I can be of more help.

        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.