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
XamDataGrid Field Binding nullable types RecordContainerGenerationMode


I am using a XamDataGrid with the datasource bound to a collection of interfaces, which are resolved to the respective classes via UnityContainer. The fields are defined with namebinding, underlying types are short, string, int?, decimal?. RecordContainerGenerationMode is not set, so judging from the blog I found click here it is set to recycle.

Now to my problem: the values in cells whose types are nullable, like int? or decimal?, are sometimes horizontal aligned left sometimes right and this behavior is not coherent over the rows. Row 1 and 2 can be correctly aligned right, Row 3 is aligned left, Row 4 is right, and some are empty because of the null value. Which cells are aligned wrong is random and changes with scrolling. There is no styling on the grid.

This behavior is fixed if I set RecordContainerGenerationMode to anything other than recycle, or if I change the underlying type to int eg. decimal (what I do not want). Setting the RecordContainerGenerationMode to anything other than recycle, results in a feelable performance decrease either in scrolling or on the initialization of the view.

I tried to define a style for XamNumericEditor and XamCurrencyEditor to always align right and I can see these settings in Snoop, but the values are still displayed left. For the wrongfully aligned cells, if I check the settings with snoop, there is no hint on why they are displayed left.


<igEditors:XamDataGrid DataSource="{Binding Children, ValidatesOnNotifyDataErrors=True}"
                     ActiveDataItem="{Binding SelectedItem, Mode=OneWayToSource, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=False}">
        <dataPresenter:FieldSettings AllowRecordFiltering="True" AllowEdit="False" AllowSummaries="False" />
                <dataPresenter:FieldSortDescription FieldName="ProduktId" Direction="Ascending" />
                <dataPresenter:Field Name="ProduktId"/>
                <dataPresenter:Field Name="Status"/>
                <dataPresenter:Field Name="FirmaBezeichnung"/>
                <dataPresenter:Field Name="ProduktCode"/>
                <dataPresenter:Field Name="ProduktArtId"/>
                <dataPresenter:Field Name="ProduktBezeichnung"/>
                <dataPresenter:Field Name="MindestProduktLaufzeitInJahren"/> 
                <dataPresenter:Field Name="DefaultProduktLaufzeitInJahren"/>
                <dataPresenter:Field Name="TarifBezeichnung"/>
                <dataPresenter:Field Name="GeschaeftsBereichBezeichnung"/>
                <dataPresenter:Field Name="ProduktMindestFolgePraemie"/>
                <dataPresenter:Field Name="ProduktMindestJahresPraemie"/>
                <dataPresenter:Field Name="AutomatischeVerlaengerung"/>

MindestProduktLaufzeitInJahren and DefaultProduktLaufzeitInJahren are of type int?

ProduktMindestFolgePraemie and ProduktMindestJahresPraemie are of type decimal?

  • 28670
    Offline posted

    Hello Matthias,

    I have been investigating into this behavior you are reporting, and being that this behavior only happens for you when RecordContainerGenerationMode is set to “Recycle,” I would have to imagine it has something to do with the virtualization of the grid, but I cannot be sure as to what at the moment. I have put together a sample project in an attempt to reproduce this behavior, but at the moment, I cannot see the behavior you are seeing.

    It is also worth noting that you should be able to align the content of your Field elements in a uniform way by setting the HorizontalContentAlignment property of the Field, rather than going to the editor.

    I have attached the sample project I used to test this.  Please test this project on your PC; whether or not it works correctly may help indicate the nature of this problem.

    If the project does not work correctly, this indicates either a problem possibly specific to your environment, or a difference in the DLL versions we are using.  My test was performed using version 18.2.20182.186 in Infragistics for WPF 2018.2.

    If the project does show the product feature working correctly, this indicates a possible problem in the code of your application.  It will help if you can provide a small, isolated sample application that demonstrates the behavior you are seeing.

    Or, if this sample project is not an accurate demonstration of what you're trying to do, please feel free to modify it and send it back, or send a small sample project of your own if you have one.

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

Reply Children
No Data