Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Silverlight > RibbonBar > Override SaveCommand

Answered Override SaveCommand

Feed from this thread
  • Hans avatar

    Posted on Nov 22, 2011 (permalink)

    Hello,

    I'm trying to override the default save command. I don't want to save the data on the local file system, but I want the file to be directly uploaded to a server. Is it somehow possible to override that command without changing the datacontext so that the other commands in the RibbonBar keep working like they have to?

    Reply

  • Answer Mihail Mihail admin's avatar

    Posted on Nov 25, 2011 (permalink)

    Hi Hans,

    Unfortunately you would not be able to override the built-in commands, but you can create your own custom command. Please take a look at the following post for how you can do this:
    http://www.telerik.com/community/forums/silverlight/richtextbox/custom-command.aspx

    Or you can simply wire-up a new event handler to the Save ribbon button and put the logic there.

    If you need further assistance do not hesitate to contact us.

    Regards,
    Mihail
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

    Reply

  • Hans avatar

    Posted on Nov 28, 2011 (permalink)

    Hello Mihail,

    I read the post you linked, but I'm using the MVVM pattern and I have no idea how to bind those custom commands in that case.
    Do you have an example of some kind that can help me?

    Reply

  • Hans avatar

    Posted on Nov 28, 2011 (permalink)

    As an addition to my previous reply; I made two command classes following the post: SaveFileCommand and SaveFileAsCommand.
    When I try to bind those to the Save and SaveAs button, the buttons do not react to those commands. (the Commands are initialized as static ICommands due to the use of static functions)
    How can I bind those commands properly using MVVM?

    Reply

  • Iva Toteva Iva Toteva admin's avatar

    Posted on Nov 30, 2011 (permalink)

    Hi Hans,

    Please find attached a demo illustrating how custom commands can be bound to in RadRichTextBoxRibbonUI and wired to work with RadRichTextBox.
    The commands in the demo are not declared as static properties. If you have to use static commands in your application, you can create other static commands, that resolve the respective instance command.
    I hope this helps.

    Kind regards,
    Iva Toteva
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

    Attached files

    Reply

  • Hans avatar

    Posted on Nov 30, 2011 (permalink)

    Hello Iva,

    I tried to combine the attached demo with the project I'm working on, but for some reason the commands aren't executed.
    As in the demo I used a separate CommandViewModel and bound it to the Editors DataContext, but for some reason the RibbonUIButtons won't react to it. 
    Could this be because the RadRichTextBox is in a RadWindow?

    Best Regards, 
    Hans

    Reply

  • Iva Toteva Iva Toteva admin's avatar

    Posted on Dec 5, 2011 (permalink)

    Hi Hans,

    I modified the previous solution to include the editor in a RadWindow, but the behavior was the same as in the first case. You can find it attached to this post.
    If you are not able to resolve the issue in your application, you can attach a demo of yours in the support ticket you opened, so that we can help you identify the reason why the commands are not executed.

    Regards,
    Iva Toteva
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Silverlight > RibbonBar > Override SaveCommand