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
1590
Questions on ActualPosition and grid.FieldLayouts[0].Fields collection.
posted

Hi.

I have 2 questions regarding columns positions/reordering.

1)During my analyzing the column's field.ActualPosition.Column property I've found its strange  behaviour if FieldLayout contains hidden columns (columns with column.Visibility  = Visibility.Collapsed)

I've attached the simple application, that contains XamDataGrid bound with BindToSampleData="True".

Steps to reproduce:

I have hidden the first two columns:  "name" and "department" in Loaded event handler( it doesn't matter where you will hide these columns, you would do this in OnButtonClick event handler, for example). Then I displayed the field.ActualPosition.Column for each columns(after click on the corresponding button):



As you can see the result is very strange. It sounds like the field.ActualPosition.Column try to take into account whether column is hidden or not. But this is very ugly that the columns that are placed on the different positions have the same ActualPositions values. Please, comment on this.

2) I moved any column via drag&drop on other position. But grid.FieldLayouts[0].Fields collection has not changed and index of column being moved also not changed. But if you will use move grid.FieldLayouts[0].Fields.Move method the grid.FieldLayouts[0].Fields collection will be repositioned and columns on UI also will be reordered as per parameters of grid.FieldLayouts[0].Fields.Move method. You can check what I described here in the sample attached.


Thanks, Alex.

ActualPositionIssuesSample.zip
Parents
No Data
Reply
  • 9694
    posted

    Hi Alex,

    I looked at the sample you posted. When I ran it, the Positions showed up as 0, 0, 0, 1. How odd that you saw 0,1,0,1. Regardless, when a field is hidden, the position property is undefined. So it is better to check that the Field is visible before using the position property.

    Also, when moving the fields with drag and drop, position is what is changed. The indexing of the fields are not modified. This is just how this is implemented. If you have any feedback or feature requests, let me know or you can request an API change at the following website:
    http://devcenter.infragistics.com/Protected/RequestFeature.aspx

    Nice quote by the way in your signature!

Children