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
130
XamGrid to XamDataGrid
posted

Hello,

recently I am trying to replace some simple XamGrid tables to to XamDataGrid and this seem to get complicated very easily.

for example:

with XamGrid I have 2 TemplateColumns bound to different properties of my viewmodel (It is working properly). What I like about it is that I can define the HeaderText. This seems not to be possible with XamDataGrid:

                                <igDP:XamDataGrid x:Name="xamDataGrid" DataSource="{Binding MyProperty}"  GroupByAreaLocation="None">
                                    <igDP:XamDataGrid.FieldLayoutSettings>
                                        <igDP:FieldLayoutSettings AutoGenerateFields="False"/>
                                    </igDP:XamDataGrid.FieldLayoutSettings>
                                    <igDP:XamDataGrid.FieldLayouts>
                                        <igDP:FieldLayout>
                                            <igDP:FieldLayout.Fields>
                                                <igDP:Field Name="MyProperty" Label="Header Text" />
                                            </igDP:FieldLayout.Fields>
                                        </igDP:FieldLayout>
                                    </igDP:XamDataGrid.FieldLayouts>
                                </igDP:XamDataGrid>

This is not working at all. I'm not even able to type anything.

However, if I set AutoGenerateFields="True", I am able to see the header "Value" (and I desperately want to chande the header). Most importantly, I am not able to type anything IF MyProperty is "empty", i.e. it has a default value of 0. I can only type something in when it is not empty. So for example if MyProperty was set to be 5, I can see the number and can change it. It also binds properly whenever I type in a different number. Why is that ?Thank you.

Kind regards,

Julian

Parents
  • 34430
    Offline posted

    Hello Julian,

    I have been investigating into the behavior you are looking to achieve, and I am curious to know what your data source is in this case? Are you binding to a collection of your own type where “MyProperty” is a property on that type, or are you binding to something like a List<string> in this case? Also, what type is “MyProperty” in this case?

    The information above will help me to potentially answer why when it is empty, you cannot modify it, but if I had to guess it very likely has something to do with the resolution of the editor within the cells. From the code snippet you have provided, you are also correct to be changing the Label property of your Field in order to change the header text.

    It is also worth noting that there is a TemplateField within the XamDataGrid’s API and you can read about its usage here: https://www.infragistics.com/help/wpf/xamdatagrid-configuring-template-field.

    Please let me know if you have any other questions or concerns on this matter.

Reply Children