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

Problem While adding tool to Image Editor

7 Answers 142 Views
ImageEditor
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Firman Hidayat
Top achievements
Rank 1
Firman Hidayat asked on 20 Mar 2014, 04:13 AM
Hi, I am Firman. I use telerik Windows Phone 7 2014 Q1. I have a plan to put image editor on my apps. All code work when I put this code :
<telerikImageEditor:RadImageEditor
            ImageSaved="RadImageEditor_ImageSaved"
            ImageEditCancelled="RadImageEditor_ImageEditCancelled"
            FileNamePrefix="telerik_edited_image"
            Source="Images/BrowseAllControlBackground."
            x:Name="imageEditor">
             
 </telerikImageEditor:RadImageEditor>

but when I put editor tool inside the code above, like this :
<telerikImageEditor:RadImageEditor
            ImageSaved="RadImageEditor_ImageSaved"
            ImageEditCancelled="RadImageEditor_ImageEditCancelled"
            FileNamePrefix="telerik_edited_image"
            Source="Images/BrowseAllControlBackground."
            x:Name="imageEditor">
            <telerikImageEditor:CropTool>
                <telerikImageEditor:CropToolRatio CustomText="Custom"
                                                 CanResize="True"/>
                <telerikImageEditor:CropToolRatio CustomText="Original"
                                                 CanResize="True"
                                                 Width="-1"
                                                 Height="-1"/>
                <telerikImageEditor:CropToolRatio Width="1" CanResize="True"
                                                 Height="1"/>
                <telerikImageEditor:CropToolRatio Width="4" CanResize="True"
                                                 Height="3"/>
                <telerikImageEditor:CropToolRatio Width="6" CanResize="True"
                                                 Height="4"/>
                <telerikImageEditor:CropToolRatio Width="7" CanResize="True"
                                                 Height="5"/>
                <telerikImageEditor:CropToolRatio Width="10" CanResize="True"
                                                 Height="8"/>
                <telerikImageEditor:CropToolRatio Width="16" CanResize="True"
                                                 Height="9"/>
  
        </telerikImageEditor:RadImageEditor>

I got an error when run it. I attach the error screenshot. What should I do?

7 Answers, 1 is accepted

Sort by
0
Victor
Telerik team
answered on 21 Mar 2014, 09:08 AM
Hi Firman,

You need to add a closing tag to your <telerikImageEditor:CropTool> tag. Noticed that it is opened, but is not closed anywhere. This is invalid XAML (and xml as well), this is why you get a XAML parse exception.

Regards,
Victor
Telerik
 

DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

 
0
Firman Hidayat
Top achievements
Rank 1
answered on 25 Mar 2014, 03:20 AM
Hi Victor,
thank you for your reply, it's my fault anyway :D
But now I got a new error, I put this code
<Grid x:Name="Editor" HorizontalAlignment="Left" Height="735" Margin="0,-32,0,0" Grid.RowSpan="2" VerticalAlignment="Top" Width="480" Background="Black">
            <telerikImageEditor:RadImageEditor x:Name="ImageProcessing" HorizontalContentAlignment="Center" Margin="0,0,0,-8" Source="/Images/sampleimage.jpg">
                <telerikImageEditor:CropTool>
                    <telerikImageEditor:CropToolRatio  CanResize="True" Width="1" Height="1">
                         
                    </telerikImageEditor:CropToolRatio>
                </telerikImageEditor:CropTool>
            </telerikImageEditor:RadImageEditor>
</Grid>

and I got this error (on attachment). What should I do? Thank you :)
0
Todor
Telerik team
answered on 27 Mar 2014, 08:36 AM
Hello,

I am not able to reproduce the exception from the provided code. You can send us a sample project that reproduces it so we can assist you further.

Regards,
Todor
Telerik
 

Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

 
0
Firman Hidayat
Top achievements
Rank 1
answered on 28 Mar 2014, 03:21 AM
Hi Todor, here is my project http://1drv.ms/1eXAHqO
Thank you :)
0
Victor
Telerik team
answered on 31 Mar 2014, 02:22 PM
Hi Firman,

I downloaded the project and it runs fine. There must be something wrong with your visual studio setup. Or the project on your machine somehow got corrupted. Please see the attached screenshot, this is the app with no changes, as downloaded from your one drive account.

Regards,
Victor
Telerik
 

Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

 
0
Firman Hidayat
Top achievements
Rank 1
answered on 01 Apr 2014, 03:15 AM

Thank you victor, anyway I am using visual studio 2012 pro and samsung device for development. Today I tried write the code using C#, and it works well on my device. but I have a problem, I attach crop tool into my image editor, but it wont resizing. Here is my code :

RadImageEditor imageEditor = new RadImageEditor();
imageEditor.Source = new BitmapImage(new Uri("/Background.png", UriKind.Relative));
 
imageEditor.Tools.Add(new CropTool()
{
   SelectedRatio = new CropToolRatio()
    {
      Width = 1,
       Height = 1,
       CanResize =  true
     }
});
 
LayoutRoot.Children.Add(imageEditor);
0
Victor
Telerik team
answered on 04 Apr 2014, 07:44 AM
Hi Firman,

I have modified your code slightly.
RadImageEditor imageEditor = new RadImageEditor();
imageEditor.Source = new BitmapImage(new Uri("/ApplicationIcon.png", UriKind.Relative));
 
CropTool crop = new CropTool();
crop.SupportedRatios.Add(new CropToolRatio()
    {
        Width = 1,
        Height = 1,
        CanResize = true
    });
crop.SelectedRatio = crop.SupportedRatios[0];
 
imageEditor.Tools.Add(crop);
 
LayoutRoot.Children.Add(imageEditor);

You need to add the crop ratio to the supported ratios.

Please write again if you need further assistance.

Regards,
Victor
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
ImageEditor
Asked by
Firman Hidayat
Top achievements
Rank 1
Answers by
Victor
Telerik team
Firman Hidayat
Top achievements
Rank 1
Todor
Telerik team
Share this question
or