Click here to Skip to main content
15,881,248 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I simply want to display the table in my database on DataGrid. Can anybody tell me what code should be written in view,model and viewModel so as to display the table of my sql server in datagrid. I need this thing to be implemented in prism mvvm framework. Also guide me through the connectivity of the same.
Posted
Updated 27-Oct-14 20:43pm
v2
Comments
Mycroft Holmes 28-Oct-14 3:54am    
If you need guiding then you would be better served by searching for a tutorial rather than a Q&A.
Member 11143298 28-Oct-14 9:21am    
Yes you are right I went for tutorials but cold not get where to code for Views,Models and ViewModels...I shall be highly obliged if you shall do the needful. Thanks in advance.

1 solution

WPF and Silverlight don't do dynamic happily, you need to create a collect that reflects your display content and move the records from your datatable into the collection to be displayed.

In xaml you need to define each column and map it to a filed in the collection.

If you truly need a dynamic View then you are going to need to research it using the UI control you intend to use. Eg with Telerik I have seen examples where the Viewmodel buils up a collection of columns and they are bound to the datagrid.
 
Share this answer
 
Comments
Member 11143298 28-Oct-14 9:19am    
Would you care to give me any kind of examples or any thing through which i could understand the concepts. I have tried with simple MVVM but not well verse with Prism.
Your help would be highly appreciable.
Mycroft Holmes 28-Oct-14 18:26pm    
Sorry I don't use prism and I don't know the capabilities of your control so my help is going to be limited. If I can find the examples I ran across - Telerik dynamic columns radgridview - keywords may help, I will post the link.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900