I want to display an image editor withuot tools. (I need only the ability to control the brightness and contrast, what I can do programmatically).
I want the image will be displayed fully in the image editor, without scrolling.
How can I do that?
3 Answers, 1 is accepted
0
Hello David,
To use the image editor without the tools use only RadImageEditor, instead of RadImageEditorUI.
To control the brightness and contrast manually, you can use the ImageCommands.Contrast command. Here is an example in code:
Check also the attached project.
To display the image fully without scrolling, you can set the ScaleFactor of the RadImageEditor control to 0. This will make the control to enter auto fit mode, which means that the picture will be zoomed out so that it is full displayed.
Regards,
Martin Ivanov
Progress Telerik
To use the image editor without the tools use only RadImageEditor, instead of RadImageEditorUI.
To control the brightness and contrast manually, you can use the ImageCommands.Contrast command. Here is an example in code:
private void Button_Click(object sender, RoutedEventArgs e)
{
double contrast = 0.7; // between 0 and 2
double brightness = 0.4; // between -1 and 1
var context = new ContrastCommandContext(brightness, contrast);
this.imageEditor.ExecuteCommand(ImageCommands.Contrast, context);
}
To display the image fully without scrolling, you can set the ScaleFactor of the RadImageEditor control to 0. This will make the control to enter auto fit mode, which means that the picture will be zoomed out so that it is full displayed.
Regards,
Martin Ivanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
David
Top achievements
Rank 1
answered on 01 Nov 2018, 10:55 AM
Thank you.
It almost what I want: I want the image to be exactly in the same size as the image editor, and let it stretch if needed.
Is it possible?
0
Hello David,
There is not such functionality in the control, but you should be able to achieve your requirement by playing with the ScaleFactor property of the control. So, you can zoom the image so that it fits into the RadImageEditor's size.
An alternative approach would be to manually set the Width and Height of the Grid panel holding the image, when you open a new file. For example:
Regards,
Martin Ivanov
Progress Telerik
There is not such functionality in the control, but you should be able to achieve your requirement by playing with the ScaleFactor property of the control. So, you can zoom the image so that it fits into the RadImageEditor's size.
An alternative approach would be to manually set the Width and Height of the Grid panel holding the image, when you open a new file. For example:
private
void
ImageEditor_CommandExecuted(
object
sender, Telerik.Windows.Media.Imaging.ImageEditorCommands.ImageCommandExecutedEventArgs e)
{
if
(e.Command
is
OpenImageCommand)
{
Grid imageView =
this
.imageEditor.ChildrenOfType<Grid>().FirstOrDefault(x => x.Name ==
"ImageView"
);
imageView.Width =
this
.imageEditor.ActualWidth;
imageView.Height =
this
.imageEditor.ActualHeight;
}
}
Regards,
Martin Ivanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.