We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Diagram Builder image export problem

Thread ID:

Created:

Updated:

Platform:

Replies:

116072 Mar 27,2014 08:40 AM Mar 31,2014 02:11 AM WinRT 3
loading
Tags: SfDiagram
Sandeep Kandula
Asked On March 27, 2014 08:40 AM

We tried to export the image from Diagram Builder using the above source code but it fails with a null reference exception in graph.export() as mentioned in the attachment.
In DiagramBuilder.xaml, we made the following changes :

<Button Foreground="White" x:Name="export" Background="Black" Visibility="{Binding Export}">

<Button.Flyout>

<MenuFlyout>

<MenuFlyoutItem Text="Png" Command="{Binding SelectedDiagram.Export}" CommandParameter="Png"/>

<MenuFlyoutItem Text="Jpeg" Command="{Binding SelectedDiagram.Export}" CommandParameter="Jpeg"/>

<MenuFlyoutItem Text="Tiff" Command="{Binding SelectedDiagram.Export}" CommandParameter="Tiff"/>

<MenuFlyoutItem Text="Gif" Command="{Binding SelectedDiagram.Export}" CommandParameter="Gif"/>

<MenuFlyoutItem Text="JpegXR" Command="{Binding SelectedDiagram.Export}" CommandParameter="JpegXR"/>

</MenuFlyout>

</Button.Flyout>

<Button.Style>

<Style TargetType="ButtonBase" BasedOn="{StaticResource DiagramBuilderPathBasedAppBarButtonStyle}">

<Setter Property="AutomationProperties.AutomationId" Value="OpenFileAppBarButton"/>

<Setter Property="AutomationProperties.Name" Value="Export"/>

<Setter Property="Content" Value="M45.963548,8.269645L62.665147,25.065546 45.963548,39.871244 45.963548,31.963644C45.963548,31.963644 17.120617,24.075571 9.909945,39.871244 9.9099454,35.922571 12.530199,16.167482 45.963548,16.167483z M0,0L41.778571,0 41.778571,4.1795139 41.778571,8.3590277 37.598714,8.3590277 37.598714,4.1795139 4.1798577,4.1795139 4.1798577,45.954649 37.598714,45.954649 37.598714,41.775137 41.778571,41.775137 41.778571,45.954649 41.778571,50.134165 37.598714,50.134165 0,50.134165 0,45.954649 0,4.1795139z"/>

</Style>

</Button.Style>

</Button>


Attachment: Capture_fc407f78.zip

Parthiban A [Syncfusion]
Replied On March 28, 2014 07:53 AM

Hi Sandeep,

Some of the features will be available only in winRt 8.1, to toggle those we use conditional compilations in project setting. Kindly refer the screen shot from attachment.

In the provided sample we have missed those conditional compilation, so that export and print feature is not enabled. We have added that, now we can print and export the diagram page. Below code snippet represent enabling feature for winRt 8.1.

#if SyncfusionFramework4_5_1

            MenuFlyout menu = new MenuFlyout();

            Binding bind = new Binding { Path = new PropertyPath("SelectedDiagram.Export") };

            List<string> formats = new List<string> { "Png", "Jpeg", "Gif", "Tiff", "Jpegxr" };

            foreach (var item in formats)

            {

                MenuFlyoutItem menuItem = new MenuFlyoutItem

                {

                    Text = item,

                    CommandParameter = item

                };

                menuItem.SetBinding(MenuFlyoutItem.CommandProperty, bind);

                menu.Items.Add(menuItem);

            }

            export.Flyout = menu;

#endif

So the modification which you have made in your sample is no more needed, after setting conditional compilations. Now print and export feature will be enabled by default.

Kindly find the modified sample from attachment.

Note: As we have implemented print and export feature only for windows 8.1, it will not work in windows 8.0.

Regards,

Parthiban


Attachment: DiagramBuilder_modified_e8901a9c.zip

Sandeep Kandula
Replied On March 28, 2014 08:26 AM

Thanks a lot. It works!

Parthiban A [Syncfusion]
Replied On March 31, 2014 02:11 AM

Hi Sandeep,

Thanks for your update.

Please let us know, if you require any further assist on this.

Regards,

Parthiban




CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;