Issue: Telerik.Windows.Documents.Spreadsheet vs Telerik.Documents.Spreadsheet

1 Answer 286 Views
Spreadsheet
Yaakov
Top achievements
Rank 1
Yaakov asked on 01 Aug 2021, 08:54 PM

In my current WPF/MVVM project, which uses package Telerik.Windows.Controls.Spreadsheet.for.Wpf.Xaml for a view, I would like to keep the ViewModel in a netstandard2.0 project. The ViewModel project references package Telerik.Documents.Spreadsheet and exposes a property of type Telerik.Windows.Documents.Spreadsheet.Model.Workbook to which the view binds in XAML.
At runtime I get (nonsensical?) XAML Binding Failures:
1. Cannot create default converter to perform 'one-way' conversions between types 
    'Telerik.Windows.Documents.Spreadsheet.Model.Workbook' and 
    'Telerik.Windows.Documents.Spreadsheet.Model.Workbook'. 
    Consider using Converter property of Binding.
 2. Value 'Telerik.Windows.Documents.Spreadsheet.Model.Workbook' (type Workbook) 
    cannot be assigned to property RadSpreadsheet.Workbook (type Workbook).
Adding an empty "no-op" System.Windows.Data.IValueConverter gets rid of those, but still an empty grid is displayed, although the ViewModel constructor prepopulates the spreadsheet.  
Note the system behaves as expected when I instead use the same code in the net5.0 project that via package Telerik.Windows.Controls.Spreadsheet.for.Wpf.Xaml references package Telerik.Windows.Documents.Spreadsheet (which also has type Model.Workbook)

If Telerik.Windows.Documents.Spreadsheet and Telerik.Documents.Spreadsheet serve different purposes, why do they have the same namespaces?
How can I have my ViewModel in netstandard2.0?

Please find a small repro attached.
In Telerik.Spreadsheet.WPF.csproj switch Property "ViewModel" between values "direct" and "indirect" to toggle between the two versions.

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 03 Aug 2021, 08:04 AM

Hello Yaakov,

Unfortunately, there is no way to use both libraries in a single project. Originally the Net Standart library was meant to have all features like the NET Framework one and this is why the namespaces are the same. However, there are some features that are not available out of the box in the NET Standard library (text measuring for example) and this is why it cannot be used as a substitute at the moment. The only solution I can suggest is to use the assemblies built for NET 5 in this case. 

Thank you for your understanding.

Regards,
Dimitar
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Yaakov
Top achievements
Rank 1
commented on 03 Aug 2021, 09:40 AM

Dimitar

Thank you  for your rapid clarification.

I have since changed that Workbook bit of my code to be a NET View Service that via an IoC container gets injected into my NET Standard ViewModel., so I'm fine. :-)

Kind regards.

Yaakov

Dimitar
Telerik team
commented on 03 Aug 2021, 09:50 AM

I am glad that you have a solution for your case. 

Do not hesitate to contact us if you have other questions.
Tags
Spreadsheet
Asked by
Yaakov
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or