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
405
Xamgrid bound to viewmodel with properties known at runtime
posted

Good morning.

I was wondering if you could provide a small sample that shows how to create a xamgrid bound to a viewmodel with a number of properties known only at runtime. Each of these properties would have their own column and would be editable.

I found a good example for the xamdatagrid but I need this to work for the xamgrid.

Here is the link to the xamdatagrid sample. It explains really well what I need.

http://es.infragistics.com/community/blogs/blagunas/archive/2012/10/24/xamdatagrid-dynamically-create-and-data-bind-columns-with-an-editor-of-your-choice.aspx

Thank you in advance

  • 29065
    Offline posted

    Hello Roberta,

    Thank you for contacting Infragistics. I've attached a sample below that binds the XamGrid to the StaffMembers ViewModel, aquired from the link you've posted. The only differences from using the XamDataGrid is that you need to reference the ItemSource property to hook up the binding and create a EditingSettings reference to set the AllowEditing property to Row, cell etc.

    eg.


    <ig:XamGrid x:Name="MyGrid" ItemsSource="{Binding StaffMembers}">
                <ig:XamGrid.EditingSettings>
                    <ig:EditingSettings AllowEditing="Row"></ig:EditingSettings>
                </ig:XamGrid.EditingSettings>
    </ig:XamGrid>

    Let me know if you have any questions regarding this matter.

    ViewModelBinding.zip