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
1715
ValueEditor ValueChanged Event buggy?
posted

I have a very simple grid setup with the following XAML:

 <igDP:XamDataGrid Grid.Row="0" Name="grid" igEditors:ValueEditor.ValueChanged="ValueChanged" Height="80">
            <igDP:XamDataGrid.FieldLayoutSettings>
                <igDP:FieldLayoutSettings AutoGenerateFields="False" />
            </igDP:XamDataGrid.FieldLayoutSettings>

            <igDP:XamDataGrid.FieldLayouts>
                <igDP:FieldLayout>
                    <igDP:FieldLayout.Fields>
                        <igDP:Field Name="Name" Label="Name" />
                        <igDP:Field Name="Last" Label="Last" />
                    </igDP:FieldLayout.Fields>
                </igDP:FieldLayout>
            </igDP:XamDataGrid.FieldLayouts>
        </igDP:XamDataGrid>

Simple enough, right? I catch the ValueEditor.ValueChanged event. The idea is that I can then get the ValueEditor's Host (which is a ValuePresenter) and I could change the background color of the CellValuePresenter.

However, if it seems that by scrolling the grid, the ValueChanged event is raised and it passes Value = null. This is really strange and, for my purposes, makes no sense.

I could catch the CellUpdated event on the grid, but I don't know how to get the CellValuePresenter from an instance of a Cell.


Thanks,

- Szymon

Parents
  • 1715
    posted

    I believe this is a side-effect from the cell virtualization feature. Cell virtualization tries to reuse the existing cell value presenters and their ValueEditors. Becuase the code automatically resets the values inside the ValueEditors to match the current rows, ValueChanged is raised. I suppose that this is more of a feature than a bug, since in a way its behavior that is defined, but... this is quite annoying and unexpected.

     

    Worse of all, setting a field's AllowCellVirtualization setting to False, doesn't solve the issue. 

     -Szymon

Reply Children
No Data