Problem While adding tool to Image Editor

8 posts, 0 answers
  1. Firman Hidayat
    Firman Hidayat avatar
    5 posts
    Member since:
    Jun 2013

    Posted 19 Mar 2014 Link to this post

    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?
  2. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 21 Mar 2014 Link to this post

    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.

     
  3. DevCraft banner
  4. Firman Hidayat
    Firman Hidayat avatar
    5 posts
    Member since:
    Jun 2013

    Posted 24 Mar 2014 in reply to Victor Link to this post

    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 :)
  5. Todor
    Admin
    Todor avatar
    778 posts

    Posted 27 Mar 2014 Link to this post

    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.

     
  6. Firman Hidayat
    Firman Hidayat avatar
    5 posts
    Member since:
    Jun 2013

    Posted 27 Mar 2014 in reply to Todor Link to this post

    Hi Todor, here is my project http://1drv.ms/1eXAHqO
    Thank you :)
  7. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 31 Mar 2014 Link to this post

    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.

     
  8. Firman Hidayat
    Firman Hidayat avatar
    5 posts
    Member since:
    Jun 2013

    Posted 31 Mar 2014 in reply to Victor Link to this post

    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);
  9. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 04 Apr 2014 Link to this post

    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.

     
Back to Top
DevCraft banner