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

Hello,

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.

Regards

<igEditors:XamDataGrid DataSource="{Binding Children, ValidatesOnNotifyDataErrors=True}"
                     ActiveDataItem="{Binding SelectedItem, Mode=OneWayToSource, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=False}">
    <igEditors:XamDataGrid.FieldSettings>
        <dataPresenter:FieldSettings AllowRecordFiltering="True" AllowEdit="False" AllowSummaries="False" />
    </igEditors:XamDataGrid.FieldSettings>
    <igEditors:XamDataGrid.FieldLayouts>
        <dataPresenter:FieldLayout>
            <dataPresenter:FieldLayout.SortedFields>
                <dataPresenter:FieldSortDescription FieldName="ProduktId" Direction="Ascending" />
            </dataPresenter:FieldLayout.SortedFields>
                <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"/>
            </dataPresenter:Field>
        </dataPresenter:FieldLayout>
    </igEditors:XamDataGrid.FieldLayouts>                     
</igEditors:XamDataGrid>

MindestProduktLaufzeitInJahren and DefaultProduktLaufzeitInJahren are of type int?

ProduktMindestFolgePraemie and ProduktMindestJahresPraemie are of type decimal?

Parents Reply Children