We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

DataGrid icons and sorting

Hi! I was just taking a look at your dataGrid examples, they have been really useful thanks! However, the example to add icons seems to fix the icons to a specific row of the data grid so that as the data is resorted the icons do not sort with it. I''m doing the following to try and attempt this based on your example, the "Type" columns basically gives an index value that corresponds to the icons I have loaded in the image list called "Icons". Even though I have forced my styles to be redone after a sort of the data grid the icons still seem stuck in place as per the original order. Just a theory, is this becasue the table actually doesn''t reorder, but the view of that table in the data grid does reorder? Any pointers you can give would be appreciated! thanks Chris Function MyGetImageIndexForRow(ByVal row As Integer) As Integer Dim dataTable As DataTable = CType(MusicDataGrid.DataSource.Tables(0), DataTable) Return dataTable.Rows(row).Item("Type") dataTable.Dispose End Function ..... Dim tmpc as DataColumn For Each tmpc In dataTable.Columns If tmpc.ColumnName = "Icon" Then Dim iconColumn As DataGridIconOnlyColumn iconColumn = New DataGridIconOnlyColumn(Icons, New delegateGetIconIndexForRow(AddressOf MyGetImageIndexForRow)) iconColumn.HeaderText = "" iconColumn.MappingName = "Icon" iconColumn.Width = Me.Icons.Images(0).Size.Width tableStyle.GridColumnStyles.Add(iconColumn) Exit For End If Next

Loader.
Live Chat Icon For mobile
Up arrow icon