SfDataGrid PrintPreview not working

When I try to get printpreview of SfDataGrid I get following error


System.Windows.Markup.XamlParseException: 'Add value to collection of type 'System.Windows.Controls.UIElementCollection' threw an exception.'

Inner Exception

FileNotFoundException: Could not load file or assembly 'Syncfusion.Shared.Wpf.Classic, Culture=neutral' or one of its dependencies. The system cannot find the file specified.

DO


7 Replies 1 reply marked as answer

VS Vijayarasan Sivanandham Syncfusion Team December 16, 2021 02:41 PM UTC

Hi Amit Saraf,

Case 1:
Syncfusion assembly not added

Based on provided information we suspect that in your application does not contains the Syncfusion.Shared.Wpf.Classic assembly. So, you can resolve the reported problem by adding Syncfusion.Shared.Wpf.Classic assembly to use SfDataGrid control. Please refer the below screenshot,



Case 2:  Syncfusion assemblies are not referred properly in application

 
We suspect that your assemblies are not referred properly. Can you please confirm the below things?   

        1. Please ensure all the Syncfusion dependency assemblies are referred from the same location.
 
        2. Please check in your sample using assemblies are contain same version of Syncfusion product? If not, can you please refer the same version assembly of Syncfusion product.

if you still facing the same issue, can you please share us below things?
       
        1. Syncfusion updated version   
        2. Video illustration of the reported issue
        3.
Confirm whether you are using our product using our Essential Studio installer or by using NuGet from nuget.org
  
 
It will be helpful for us to check on it and provide you the solution at the earliest.     
   
Regards,   
Vijayarasan S 



AS Amit Saraf December 17, 2021 06:36 AM UTC

Thanks for your reply


This issue came only after updating my syncfusion assemblies from 18.3.0.35 to 19.3.0.53


There is no change in my project and all the assemblies are referred properly


I just posted this issue here so that if there is any change in assembly reference then ok else if any problem then please check


Thanks for reply

Amit Saraf



VS Vijayarasan Sivanandham Syncfusion Team December 20, 2021 12:18 PM UTC

Hi Amit Saraf

We have added the Syncfusion.Shared.WPF.Classic Assembly in 18.4 version. If you are using the 19.3 Syncfusion assembly version, you will need to add the Syncfusion.Shared.WPF.Classic assembly. We accepted it breaking changes. For more details about breaking changes, please refer the below release notes link.

Release Notes Link: https://help.syncfusion.com/wpf/release-notes/v18.4.0.30?type=all#common-breaking-changes 

Regards, 
Vijayarasan S 


Marked as answer

ER Erik May 31, 2023 10:22 PM UTC

Hi,


I'm using 21.1.35 and I've tried 21.2.8 and I get the exact same error. I'm referencing the packages in my project file:


    <PackageReference Include="Syncfusion.SfChart.WPF" Version="21.1.35" />

    <PackageReference Include="Syncfusion.SfGrid.WPF" Version="21.1.35" />


The Shared package is referenced implicitly, but the Classic isn't to be found... what can be the issue?



VS Vijayarasan Sivanandham Syncfusion Team June 1, 2023 04:08 PM UTC

Hi Erik,

We have delisted all our classic assemblies (tools classic, shared classic, and some of our themes). That’s why the Syncfusion.Shared.Wpf.Classic assembly was not found while searching in the NuGet packages.

However, you can resolve the reported problem by installing Syncfusion.Shared.Wpf.Classic assembly in your application.

NuGet Details Link: 
https://www.nuget.org/packages/Syncfusion.Shared.WPF.Classic

Note: You can install this NuGet package by the command in the Package Manager Console. Refer to the below-mentioned screenshot for opening the Package Manager Console in Visual Studio.
Graphical user interface, text, application

Description automatically generated

Install Command:


Find the sample demo in the attachment.

Regards,
Vijayarasan S

If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.


Attachment: Sample_e88e7bdf.zip


ER Erik June 2, 2023 08:23 AM UTC

Hi Vijayarasan,

Yes it works! Thank you for your quick response!

Since this this package is unlisted, may I assume that this way of Print Preview isn't the recommended way to do it (anymore)? According to the docs it is...


Kind regards,

Erik



VS Vijayarasan Sivanandham Syncfusion Team June 2, 2023 02:16 PM UTC

Erik,

The current look and feel of the PrintPreviewWindow is achieved by applying the Metro theme.  However, we would like to inform you that this assembly has been removed since Syncfusion version (v19.4.0.56) due to being classified as classic. Therefore, we kindly request you to install the package through the Package Manager as we suggested in our previous updates to resolve this issue. This is the recommended way to print the data by using the ShowPrintPreview method.


Loader.
Up arrow icon