This is a migrated thread and some comments may be shown as answers.

RadImageEditorUI zoom auto and export formats

5 Answers 173 Views
ImageEditor
This is a migrated thread and some comments may be shown as answers.
Louis-Guillaume
Top achievements
Rank 1
Louis-Guillaume asked on 04 Feb 2017, 09:41 PM

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

5 Answers, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 08 Feb 2017, 09:58 AM
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.
0
Louis-Guillaume
Top achievements
Rank 1
answered on 08 Feb 2017, 10:13 AM

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

0
Accepted
Martin Ivanov
Telerik team
answered on 10 Feb 2017, 09:29 AM
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.
0
Louis-Guillaume
Top achievements
Rank 1
answered on 10 Feb 2017, 12:46 PM

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!

0
Louis-Guillaume
Top achievements
Rank 1
answered on 11 Feb 2017, 12:59 PM

Test confirmed! it works like a charm :)

 

thx

Tags
ImageEditor
Asked by
Louis-Guillaume
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Louis-Guillaume
Top achievements
Rank 1
Share this question
or