I wasted lot of time in the internet to search on this topic. But still I couldn't understand how to do it. Can anyone give me code snippets of the view model and the Xaml? It would be better if anyone can give me a sample project.
Hello Haritha,
Thank you for your email. I have been looking into your question and since you wish to create an MVVM application with the XamPivotGrid, I assume that you wish to use a FlatDataSource. I have created a sample application for you, that shows how you can create a FlatDataSource and use it with the XamPivotGrid. Also, you can read more detailed information regarding using the FlatDataSource with the XamPivotGrid, here in our documentation: http://help.infragistics.com/NetAdvantage/WPF/current/CLR4.0/?page=xamPivotGrid_DataBinding_Using_FlatDataSource.html.
Please let me know if you need any further assistance on the matter.
Sincerely,
Krasimir
Developer Support Engineer
Infragistics
www.infragistics.com/support
Hi,
You example is great. However, in my case (and most of the times) the viewmodel does not have a parameterless constructor.
The below line in the example is the problem:
<vm:FlatDataSourceViewModel x:Key="FlatDataSourceViewModel"/>
Could you please provide an example for a viewmodel that has multiple parameters ?
Thanks
Amit Kamat
This is a problem for me as well.
we are currently evaluating the Infragistics Pivot control but it's not MVVM friendly at all.
Can you help us by giving an example that uses the pivot control bound to a collection on a ViewModel?
We really like the ability to do cell editing though. so, it's a shame that we cannot use the your controls.
Thanks,
Suneth
This is an issue for me as well. Instead of having to rely on a declared resource such as a ViewModel (with or without parameters in the constructor, if that is even possible), it would be better to be able to bind the ItemsSource to any property within the DataContext (ViewModel).
The will work... but only when the default (parameterless) constructor is used for the ViewModel; for example, during design-time. This is not how the ViewModel is instantiated during run-time in my app:
<vm:MainViewModel x:Key="MainViewModel" />
<olap:FlatDataConnectionSettings x:Key="FlatDataConnectionSettings" ItemsSource="{Binding Source={StaticResource MainViewModel}, Path=TradeList}"/>
Something like this would be ideal:
<olap:FlatDataConnectionSettings x:Key="FlatDataConnectionSettings" ItemsSource="{Binding TradeList}"/>
Why is it that the DataSource for XamDataGrid is a DependencyProperty, while DataSource for XamPivotGrid is not?
Cheers,
--Vince