MVVM and PivotGrid

11 posts, 0 answers
  1. Ceramist
    Ceramist avatar
    31 posts
    Member since:
    Aug 2008

    Posted 14 Mar 2013 Link to this post

    What might be the best solution using MVVM to interface to PivotGrid?  Should my ViewModel simply deliver a LocalDataSourceProvider for binding by the PivotGrid?
  2. Rosen Vladimirov
    Admin
    Rosen Vladimirov avatar
    640 posts

    Posted 19 Mar 2013 Link to this post

    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.

  3. DevCraft banner
  4. tomcrusader
    tomcrusader avatar
    14 posts
    Member since:
    Jul 2009

    Posted 04 Oct 2013 Link to this post

    This was March 2013. Still not possible then, if documentation is up to date?
  5. Rosen Vladimirov
    Admin
    Rosen Vladimirov avatar
    640 posts

    Posted 04 Oct 2013 Link to this post

    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 >>
  6. tomcrusader
    tomcrusader avatar
    14 posts
    Member since:
    Jul 2009

    Posted 04 Oct 2013 Link to this post

    Yeah, I got that working now. Thanks
  7. Christian
    Christian avatar
    3 posts
    Member since:
    May 2012

    Posted 28 Oct 2013 Link to this post

    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?
  8. Carlos
    Carlos avatar
    1 posts
    Member since:
    Aug 2012

    Posted 28 Oct 2013 Link to this post

    Rosen , is this 2013 Q2 release you're refering to?
  9. Christian
    Christian avatar
    3 posts
    Member since:
    May 2012

    Posted 28 Oct 2013 Link to this post

    For myself I can say, that I use the current Q3 (2013) release.
  10. Rosen Vladimirov
    Admin
    Rosen Vladimirov avatar
    640 posts

    Posted 29 Oct 2013 Link to this post

    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 >>
  11. Christian
    Christian avatar
    3 posts
    Member since:
    May 2012

    Posted 29 Oct 2013 Link to this post

    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?
  12. Rosen Vladimirov
    Admin
    Rosen Vladimirov avatar
    640 posts

    Posted 01 Nov 2013 Link to this post

    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 >>
Back to Top
DevCraft banner