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

RadImageEditor

1 Answer 291 Views
ImageEditor
This is a migrated thread and some comments may be shown as answers.
Mahdieh
Top achievements
Rank 1
Mahdieh asked on 11 Apr 2019, 05:38 PM

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,

 

 

1 Answer, 1 is accepted

Sort by
0
Mahdieh
Top achievements
Rank 1
answered on 15 Apr 2019, 07:36 PM

I found the answer from the support team, so I'm going to share it here as well.

The original references in my project were NoXaml. When the references are NoXaml type we should merge the required resources in the App.xaml file.
Here are some resources that can help:

https://docs.telerik.com/devtools/wpf/styling-and-appearance/xaml-vs-noxaml
https://docs.telerik.com/devtools/wpf/styling-and-appearance/styling-apperance-setting-a-theme-overview
https://docs.telerik.com/devtools/wpf/common-information/troubleshooting/invisible-controls

Tags
ImageEditor
Asked by
Mahdieh
Top achievements
Rank 1
Answers by
Mahdieh
Top achievements
Rank 1
Share this question
or