RadImageEditorUI zoom auto and export formats

6 posts, 1 answers
  1. Louis-Guillaume
    Louis-Guillaume avatar
    8 posts
    Member since:
    Jan 2013

    Posted 04 Feb Link to this post

    Hi,

    I have two questions:

    1- is it possible to set the default value of the zoomcontroller to "automatic" instead of 100 %?  if possible in XAML, or in code-behind is necessary

     

    2- is there a way (documented or code snippet) so I can filter the export format (i.e.: I only want PNG files)

     

    Thanks

  2. Martin
    Admin
    Martin avatar
    1227 posts

    Posted 08 Feb Link to this post

    Hello Louis-Guillaume,

    To change the zoom of the ZoomController you can set the ScaleFactor property of the corresponding control. Setting the ScaleFactor property to 0 is the same as setting the Auto value in the UI.
    imageEditor.ScaleFactor = 0;

    To filter the export format, you can use different approaches depending on your case. Here you can find few which you can try.
    • Call, the Save command manually and pass the filter as its CommandParameter.
      ImageEditor.Commands.Save.Execute("Png Image (.png)|");
    • Create custom saving without using the image editor save command. You can see this approach demonstrated in the Import/Export help article.

    I hope this helps.

    Regards,
    Martin
    Telerik by Progress
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
  3. Louis-Guillaume
    Louis-Guillaume avatar
    8 posts
    Member since:
    Jan 2013

    Posted 08 Feb in reply to Martin Link to this post

    Hi Martin

    1- Thanks! I understand now my mistake. In my case "imageEditor" was a RadImageEditorUI. Which means that I have to do imageEditor.ImageEditor.ScaleFactor. still it does not work as expected because I want this as default behavior but if ImageEditorUI is instanciated when the screen is opened, ImageEditor property remains null until an image is loaded. I using the default OpenFile command of the component

    2- I'll look for the saving command. If I found the SaveCommand attribute, I don't see yet how I can use it and stay full MVVM.I need to search a little longer

  4. Answer
    Martin
    Admin
    Martin avatar
    1227 posts

    Posted 10 Feb Link to this post

    Hello,

    There is no default ScaleFactor which you could set. Currently, the approach which you can use is to set the property in code when the ImageEditor is loaded. You can use the ImageEditorLoaded event of the RadImageEditorUI control.

    About staying full MVVM while using the SaveCommand, if you are using the save button of the RadImageEditorUI, you can set its SaveCommandParameter property.
    <telerik:RadImageEditorUI SaveCommandParameter="Png Image (.png)|" />

    If you are using a custom button defined somewhere outside of the RadImageEditorUI, you can bind it to a new instance of the SaveCommand and set the button's CommandParameter to the RadImageEditor control.
    <Button Content="Save" Command="{Binding SaveCommandDefinedInTheViewModel}" CommandParameter="Png Image (.png)|"/>

    Regards,
    Martin
    Telerik by Progress
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
  5. Louis-Guillaume
    Louis-Guillaume avatar
    8 posts
    Member since:
    Jan 2013

    Posted 10 Feb in reply to Martin Link to this post

    oh..so simple...I didn't think about the CommandParameter. I feel stupid now

     

    Anyway, Martin, a BIG thank you. I'll try it next week but for sure, the two solutions described seem to met perfectly my need. thanks again!

  6. Louis-Guillaume
    Louis-Guillaume avatar
    8 posts
    Member since:
    Jan 2013

    Posted 11 Feb Link to this post

    Test confirmed! it works like a charm :)

     

    thx

Back to Top