This is a migrated thread and some comments may be shown as answers.

MVVM and PivotGrid

10 Answers 187 Views
PivotGrid
This is a migrated thread and some comments may be shown as answers.
Ceramist
Top achievements
Rank 1
Ceramist asked on 14 Mar 2013, 08:51 PM
What might be the best solution using MVVM to interface to PivotGrid?  Should my ViewModel simply deliver a LocalDataSourceProvider for binding by the PivotGrid?

10 Answers, 1 is accepted

Sort by
0
Rosen Vladimirov
Telerik team
answered on 19 Mar 2013, 08:23 AM
Hello,

We are working on our MVVM support and in one of our next internal builds we'll add the functionality to bind the ItemsSource of the LocalDataSourceProvider directly, when you have set the DataContext  of the UserControl.

Hopefully this helps.

Kind regards,
Rosen Vladimirov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
tomcrusader
Top achievements
Rank 2
answered on 04 Oct 2013, 06:40 AM
This was March 2013. Still not possible then, if documentation is up to date?
0
Rosen Vladimirov
Telerik team
answered on 04 Oct 2013, 09:39 AM
Hi Thomas,

Please excuse us for not mentioning this in our documentation. You are now able to bind the ItemsSource of the LocalDataSourceProvider - you can download our latest official release and use this feature. Anyway you can use binding for the DataProvider and create the LocalDataSourceProvider in your ViewModel - the data provider is not a UI Element so this will not break the MVVM pattern.

Hopefully this helps. Feel free to contact us in case you have any other problems or concerns.

Regards,
Rosen Vladimirov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
tomcrusader
Top achievements
Rank 2
answered on 04 Oct 2013, 09:55 AM
Yeah, I got that working now. Thanks
0
Christian
Top achievements
Rank 1
answered on 28 Oct 2013, 12:18 PM
Hi. 

Unfortunately this doesn't seem to be totally true. When I use the LocalDataSourceProvider in my ViewModel and write test against that method to check the correct setup, the test can't be run. I get a UnauthorizedAccessException because I have InvalidCrossThreadAccess while instantiating (does it try to access some resource strings?). For me it seems to expect that the LocalDataSourceProvider is running on the UI thread. Any ideas for that?
0
Carlos
Top achievements
Rank 1
answered on 28 Oct 2013, 05:21 PM
Rosen , is this 2013 Q2 release you're refering to?
0
Christian
Top achievements
Rank 1
answered on 28 Oct 2013, 06:07 PM
For myself I can say, that I use the current Q3 (2013) release.
0
Rosen Vladimirov
Telerik team
answered on 29 Oct 2013, 09:51 AM
Hi,

Christian, the LocalDataSourceProvider is not a UIElement and it is executing several tasks simultaneously - it is running in async mode, so this is the reason why you get the cross-thread access exception. That's why we recommend defining your data provider in the ViewModel, not just binding its ItemsSource.

Carlos, yes, since Q2 2013 you are able to bound ItemsSource of LocalDataSourceProvider.

Feel free to contact us in case you have any problems or concerns.

Regards,
Rosen Vladimirov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Christian
Top achievements
Rank 1
answered on 29 Oct 2013, 10:40 AM
I supposed that this will be the answer. For my project I can say that I don't like the idea to put an element like this in the view model. i want to test my viewmodel, but your proposed way would prevent that. In my project I have a model that describes the data source and also comes from the server and describes the display parameters. Then I have a converter that creates a data source provider from that model. But now I wanted to test my converter to see, whether the data source is built up correctly from the model.
Do you have a proposal how to test if a datasource is set up correctly. Also in your way you have to test your viewmodel. How would you do it?
0
Rosen Vladimirov
Telerik team
answered on 01 Nov 2013, 09:42 AM
Hello Christian,

In order to creat Silverlight Unit Tests for your view model, you have to install this toolkit. After that you'll be able to add a new Silverlight Unit Test project (via Visual Studio 2010). In this project you have to add references to the following dlls:
 - Microsoft.Silverlight.Testing
 - Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight
 - Telerik.Pivot.Core
 - Telerik.Windows.Controls
 - reference to your project that will be tested.

After that you are able to write whatever tests you need. Please note that we have thousands of tests regarding RadPivotGrid and different settings of the DataProvider.

We've prepared a sample solution, which includes two projects - the first one contains RadPivotGrid and DataProvider defined in ViewModel. The second project is the test one. Is it possible to take a look at them and inform us in case you have any problems or concerns.

I'm looking forward to hearing from you.

Regards,
Rosen Vladimirov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
PivotGrid
Asked by
Ceramist
Top achievements
Rank 1
Answers by
Rosen Vladimirov
Telerik team
tomcrusader
Top achievements
Rank 2
Christian
Top achievements
Rank 1
Carlos
Top achievements
Rank 1
Share this question
or