Hi,
i am Using Infragistic 14.1 license version. in sample application i was able to use view model property as Object data source. but in my application when i am trying to use my VM property as Object data source in Report ReportDataExplorer-->ObjectdataSource-->VM Namespace.Class(select the class that will return the data)-->Select a method or Property[ here my properties are not available]
how can i make my ViewModel property to be available for choosing as object data source? so they are available in ReportDataExplorer to use in reports. Are they all should be in same namespace?
Namespace.ViewModels : public ObservableCollection<MyType> MyTypesNamespace.Views : here i am using the ReportViewer in my XAMLNamespace : here i have added myreport.igr file.
one more thing, i am using license version of INfragistics2014.1 (how can i update my profile... it shows 2014.1 trial expires) .. i am not able to log a support ticket.
Regards,Kamlendra
Hello Kamlendra,
First off, in order to update your account to the correct support level, you need to register your key to your account. This can be done at https://es.infragistics.com/my-account/register-product.
As far as using the collection from your ViewModel in a different namespace, I followed the steps you suggested and was unable to reproduce the behavior you're describing. I create a WPF application with two folders/ namespaces for the View and the ViewModels, I then added a report to the main application namespace and used a collection from the ViewModel as the data source. I then added the report viewer to my view when running the application, the data was displayed successfully in the report.
I have attached the sample project I used to test this. Please test this project on your PC; whether or not it works correctly may help indicate the nature of this problem.
If the project does not work correctly, this indicates either a problem possibly specific to your environment, or a difference in the DLL versions we are using. My test was performed using version 14.1.20141.1007 in Infragistics Reporting 14.1.
If the project does show the product feature working correctly, this indicates a possible problem in the code of your application. It will help if you can provide a small, isolated sample application that demonstrates the behavior you are seeing.
Or, if this sample project is not an accurate demonstration of what you're trying to do, please feel free to modify it and send it back, or send a small sample project of your own if you have one.
Please let me know if I can provide any further assistance.
Sincerely,
Valerie
Developer Support Supervisor - XAML
Infragistics
www.infragistics.com/support
Were you able to resolve your issue?
Hello Kamlandra,
Do you have any other questions on this matter?
Hi Valerie,
I found out the reason for my VM properties not getting listed as "ObjectDataSource". The reason is : My ViewModel constructor injection and hence i constroctor is not parameterless. the moment I shift MEF Constructor injection to MEFProperty Injection Problem of VM Properties as "Object Data Source" is solved. Now,VM Constructor is parameterless. and DataCollectionForReport is getting filled by MEF property injection. and tested on button click on view, works fine.Step 1:
[Export] [PartCreationPolicy(CreationPolicy.NonShared)]ReportViewModel{ [Import] ObservableCollection<DataCollectionForReport> DataCollectionForReport{get; set;}}
and DataCollectionForReport is getting filled by MEF property injection. and tested on button click on view, works fine.
Step 2:ReportData Explorer: Drag and Drop DataCollectionForReport on report.igr
Step 3: Run app and check in ViewModel if we are getting the Injected values.: result: yes works fine.
Step 4: Export Report to PDF. here when report fetchs the property of ViewModel(DataCollectionForReport) binded to report from ReportData Explorer. It gets the injected values as Null. Does report uses the different instance of ViewModel then created by injection? i am using Prism with MEF. how can i bind a Object entity to Report which takes values from Objects injected in ViewModel.
Thank you for the additional information, I will need to create a sample which replicates this issue so that I can investigate further. I will update you again once this is complete unless you already have a sample I could use to help jumpstart my investigation.
I was still unable to reproduce your issue. I am attaching a sample using Prism and MEF with imports for the report data source. Please test this project on your PC; whether or not it works correctly may help indicate the nature of this problem. If needed please modify the sample to better represent how you are using MEF to import your data so that I can investigate further.
Let me know if you have any questions.
hi Valerie,
I am able to solve the issue.You can close this Ticket.