Hi all,
My software have many layout files (*.lyt, *.xml) of UltraWingrid to customize UI (about 300 files). When I upgrade Infragistics from version 8.1 to 8.3, method Grid.DisplayLayout.Load throw excepion.
I have open layout file (*.lyt, *.xml) and see that: Layout file contain version: "...Infragistics.Win.UltraWinGrid.UltraGrid, Infragistics2.Win.UltraWinGrid.v8.1, Version=8.1.20081.1000..."
What must I do to convert Layout file (*.lyt) to lastest version 8.3 or avoid this error?
Thanks in advance!
Thanks for input to solve this problem.
We have the same Problem on change from v10.2 to v11.2 and we solve it with your instruction.
Hi Mike,
My software use UltraGrid very complex: Inherits, KeyActionMapping, ValueList, Dropdown... so I can reproduce in new project. But when I edit binary layout file, I found the way to resolve:
Because Layout file contain version info, so I replace old version info to lastest version: 8.1 -> 8.3
Here my solution:Replace byte in binary layout file:
Const mscShortVersion81 As String = "v8.1" Const mscShortVersion83 As String = "v8.3" Const mscLongVersion81 As String = "8.1.20081.1000" Const mscLongVersion83 As String = "8.3.20083.1009" Private bytShortVersion81() As Byte = encodeASCII.GetBytes(mscShortVersion81) Private bytShortVersion83() As Byte = encodeASCII.GetBytes(mscShortVersion83) Private bytLongVersion81() As Byte = encodeASCII.GetBytes(mscLongVersion81) Private bytLongVersion83() As Byte = encodeASCII.GetBytes(mscLongVersion83)
Private Sub ConvertLayoutFile(ByVal fileName As String) Dim file As IO.FileStream = Nothing Try file = New IO.FileStream(fileName, IO.FileMode.Open) Dim bytLayout(file.Length - 1) As Byte file.Read(bytLayout, 0, bytLayout.Length) ReplaceByteArray(bytLayout, bytShortVersion81, bytShortVersion83) ReplaceByteArray(bytLayout, bytLongVersion81, bytLongVersion83) file.Position = 0 file.Write(bytLayout, 0, bytLayout.Length) file.Flush() Catch ex As Exception Finally If file IsNot Nothing Then file.Close() file.Dispose() End If End Try End Sub Private Sub ReplaceByteArray(ByRef arrSource() As Byte, ByVal arrFrom() As Byte, ByVal arrTo() As Byte) Dim i, j As Integer Dim blnFound As Boolean = True Dim intFromLeng As Integer = arrFrom.Length For i = 0 To arrSource.Length - intFromLeng - 1 blnFound = True j = 0 While blnFound And j <= intFromLeng - 1 blnFound = blnFound And (arrSource(i + j) = arrFrom(j)) j += 1 End While If blnFound Then For j = 0 To intFromLeng - 1 arrSource(i + j) = arrTo(j) Next End If Next End Sub
My problem is resolved very well. Hope that no one meet this error.
My god!
Oh, sorry, I missed that.
If you can duplicate this in a sample project, you should Submit an incident to Infragistics Developer Support so they can check it out. As I said, this should work and you should not have to do anything. Any newer version of the grid should be able to load a layout creating with an older version. If that's not working, it's a bug and you should report it to developer support.
Thanks for your answer. Don't you see: "Exception: Object reference not set... " in subject?
I view inner exception, that is NullReferenceException from LoadLayoutHelper.
In fact, layout file doesn't backwar compatible. I have try use UltraGrid 7.3 load layout UltraGrid, this exception still exist.
In history, version Infragistics 6.x doesn't have this error
If you try with your Project, You can see. Orelse, I will give you my project with my layout files.
Thanks
What is the exception you are getting?
A layout file should be backward compatible with prior versions of the grid, you should not have to do anything to make it work.