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. Image for the cookie policy date

Diagram Builder image export problem

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

3 Replies

PA Parthiban A Syncfusion Team March 28, 2014 11:53 AM UTC

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


SK Sandeep Kandula March 28, 2014 12:26 PM UTC

Thanks a lot. It works!


PA Parthiban A Syncfusion Team March 31, 2014 06:11 AM UTC

Hi Sandeep,

Thanks for your update.

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

Regards,

Parthiban




Loader.
Live Chat Icon For mobile
Up arrow icon