How to bind custom NewFile command for Spreadsheet RadRibbonButton

3 posts, 0 answers
  1. Tomasz
    Tomasz avatar
    5 posts
    Member since:
    Dec 2013

    Posted 03 Dec 2013 Link to this post

    just like in topic, could You help me with binding my custom command to NewFile button ? 
    The thing I want to achieve is: 
    1. (my custom code) Display question box for user: 'You sure want to create new file?"
    2. trigger base NewFile command functionality (clear sheet)

    Thanks for help in advance ! 
  2. Deyan
    Deyan avatar
    158 posts

    Posted 03 Dec 2013 Link to this post

    Hello Tomasz,

    Thank you for your interest in RadSpreadsheet!

    I am attaching a demo project on how to achieve the described scenario. A few words about this demo:
    • The project contains a UserControl with RadSpreadsheet and three buttons.
    • "Custom New File Command" button executes the custom command that shows a confirm message and if this message is confirmed the default command gets executed.
    • "Default New File Command" button is bound to the default RadSpreadsheet command.
    • "Save changes" marks the UserControl's custom boolean property DocumentContentChanged as false and this way you custom command may not show the confirm message (if this is the desired behavior when user has just saved the file).
    • In order to listen for changes in current document we are attaching to the WorkbookContentChanged event. This is where DocumentContentChanged property is set to true. Additionally you may notice that we have set custom value to Workbook.WorkbookContentChangedInterval in order to make sure this event is not executed too often when the user makes changes to the document.

    I hope this is helpful! If you have any other questions or concerns please do not hesitate to contact us again!

    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. Tomasz
    Tomasz avatar
    5 posts
    Member since:
    Dec 2013

    Posted 06 Dec 2013 Link to this post

    Hi again ;) 

    Thanks for such professional answer.It all works well. 

    Tomasz Gawlik

Back to Top