c# - How do I bind a datagrid in Silverlight? -


i new silverlight.

how bind datagrid in silverlight project?

the app has 1 mainpage.xaml user control. datagrid located in mainpage.xaml user control. list of objects retrieved in mainpage.

how should go databinding list of objects datagrid?

is there other way bind this?

there 3 alternatives:

  1. databinding using xaml syntax
  2. databind in code behind
  3. setting itemssource property of datagrid instance in code behind

for alternative 1 can idea reading following post:

http://odetocode.com/code/740.aspx

for alternative 2 take on following link:

http://blogs.msdn.com/b/scmorris/archive/2008/04/14/defining-silverlight-datagrid-columns-at-runtime.aspx

alternative 3 quick way things working. following link contains simple one:

https://docs.google.com/doc?docid=0aqnzlafqzooazgzrc25ty3bfmwhzmno3c2c4&hl=en

many don't consider alternative 2 , 3 best practice , suggest go take on mvvm (modelview-viewmodel) approach.


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -