Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
145
XamGrid - dynamic columns using MVVM
posted

Hi,

How can i generate the columns dynamically in XamGrid using the collection in the ViewModel ?

<XamGrid Columns={Binding MyColumns} /> does not work.

Let me know if there is a work around for this.

Thanks

Raghu

 

 

 

Parents
No Data
Reply
  • 40030
    Offline posted

    Hi Raghu, 

    You can't bind to the Columns collection of the xamGrid, its a readonly property. You can have AutoGenerateColumns set to true and the xamGrid will automatically generate columns for your underlying data object. And, we support the AutoGenerateAttribute in the MS DataAnnotations assembly, so you can add that attribute to properties you don't want to have columns for. 

    [System.ComponentModel.DataAnnotations.Display(AutoGenerateField=false)]
    public string FirstName{get;set;}

    -SteveZ

Children
No Data