Modify the OpenCommand

3 posts, 0 answers
  1. Joao Paulo Grassi
    Joao Paulo Grassi avatar
    98 posts
    Member since:
    Feb 2011

    Posted 11 Jun 2012 Link to this post

    Hello!

    I have an ImageEditor with custom UI and everything is working great, I just want to change some functionality of the Open button. When the user clicks on it, the OpenFileDialog open but the pre-defined file type is *.PNG and every time he need's to change it to .JPG.

    Is there a way to override the OpenCommand and change the default file type of the Dialog window?

    Here's the code of the button:

    <telerik:RadImageEditorButton Grid.Column="0"
                                  Image="/Telerik.Windows.Controls.ImageEditor;Component/Images/open.png"
                                  Command="{Binding Commands.Open, ElementName=imageEditor}" />

    Thanks!
  2. Joao Paulo Grassi
    Joao Paulo Grassi avatar
    98 posts
    Member since:
    Feb 2011

    Posted 11 Jun 2012 Link to this post

    Hello again,

    I managed to modify the OpenCommand, I've created a class that inherits from OpenImageCommand and then override the ExecuteOverride method and implement my own logic to filter the Dialog for JPG images.

    Thanks!


  3. UI for WPF is Visual Studio 2017 Ready
  4. Iva Toteva
    Admin
    Iva Toteva avatar
    1319 posts

    Posted 12 Jun 2012 Link to this post

    Hello Joao,

    It is good to hear that you have managed to achieve the desired behavior by yourself. Implementing an OpenDocumentCommand which uses an OpenFileDialog with the filter you would like to have is indeed the correct way to do this.

    Regards,
    Iva Toteva
    the Telerik team

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

Back to Top