I have created a simple project to start working RadImageEditor.
The problem is that my image doesn't display in the editor at all. Even when I execute the Open command of the ImageEditor.
I'm not sure if the ImageEditor isn't visible or the image doesn't get loaded inside of it.
Since I'm not allowed to attach a zip file I'll add the code of each class of my project:
MainWindow.Xaml:
<Window x:Class="WpfApp4.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<telerik:RadImageEditor HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ScaleFactor="0" x:Name="ImageEditor" Background="Red"/>
<Button Click="Button_Click" Content="Load picture" Grid.Row="1" />
</Grid>
</Window>
MainWindow.Xaml.cx:
namespace WpfApp4
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
ImageExampleHelper.LoadSampleImage(this.ImageEditor, "RadImageEditor.png");
}
private void Button_Click(object sender, RoutedEventArgs e)
{
this.ImageEditor.Commands.Open.Execute(this.ImageEditor);
}
}
}
ImageExampleHelper.cs:
public class ImageExampleHelper
{
public static void LoadSampleImage(RadImageEditor imageEditorUI, string image)
{
Stream stream1 = File.OpenRead("D://test image//radImageEdito.png");
string extension = Path.GetExtension("D://test image//radImageEdito.png").ToLower();
IImageFormatProvider formatProvider = ImageFormatProviderManager.GetFormatProviderByExtension(extension);
if (formatProvider != null)
{
imageEditorUI.Image = formatProvider.Import(stream1);
imageEditorUI.ApplyTemplate();
imageEditorUI.ScaleFactor = 0;
}
stream1.Close();
}
}
Thanks!
Mahdieh,