Hi,
when I load a grid layout with LoadFromXml(), and the layout contains a column with a ValueList, the dropdown list does not appear.
You see the down-arrow button of the combobox in the cell, but there are no items.
I have to manually set the ValueList property for the column again to see the values of the list.
This also happens when using a BindableValueList.
Is this a bug or did I do anything wrong?
Thanks for your help.
I ran your sample, and followed your steps here, and I think you are correct, there appears to be a bug here.
aluone said:Run the project and close it, then run it again. Everything should work and the layout should be loaded.
The first time you run this project, InitializeLayout is called. This saves the design-time layout of the grid to the "layout.xml_default" file. Note that at this point, the ValueList is attached to the grid column but has no items in it.
Then you check for the existance of a "layout.xml" file, which does not exist, so nothing is loaded. Then you add three items to the list.
At this point, everything is fine, as you say.
aluone said:Click the Button. The ValueListItems are gone, and the ValueList property of the column is still set. At this point, everything is OK.
Clicking the button loads the original design-time layout where the ValueList is attached to the column, but has no items in it. The grid properly reflects this, showing numbers in the column instead of names.
aluone said:Close the running project and re-run it again (please don't delete the .xml files which were created in the Debug directory). The ValueList property of the column is still set after loading the .xml file, but it doesn't show the display values, which is not right, I think.
Closing the project now triggers the Form1_FormClosing event which saves the current layout of the grid to the "layout.xml" file. So the saved layout has a ValueList with no items in it, just like the design-time layout.When you re-run the project, this layout gets loaded into the grid. At this point, it has no items in it.
But then the code adds the items back into the ValueList.In spite of this, they are not displaying on the column and the column still shows numbers instead of name.
I checked it out and it looks like the ValueList which is attached to the column is not the same instance as the one in the ValueLists collection at this point. This is clearly a bug and needs to be investigated.
Please try the following:
1. The previous steps
2. Close the application – the two layouts are saved already
3. Remove everything from the InitializeLayout event in Form1.cs
4. Press “Yes” on “Load saved layout?” – the last saved valuelist should be assigned to the column
Please notice that in this scenario in layout_default.xml will not be saved any valuelist information and if loaded, after that on form closing in the other layout file will not be saved data for any valuelist.
Regards,
Stefaniya
your sample uses the workaround (line 33) I mentioned before. You re-assign the ValueList to the ValueList property of the grid column every time in the InitializeLayout method.
I think this should not be necessary, if I have already set this property via the Designer.
It seems like we do not find a solution for this, so I will set the property manually in the code after loading a grid layout.
Thank you,
Best regards
I apologize, I really have forgotten to upload the sample. I have modified your sample as I moved some code to the Load event of the form (please check it):
1. Run the sample
2. Press “No” to “Load saved layout?” – there must appear the grid with the valuelist defined in the initializeLayout event of the grid – this valuelist is saved in layout_default.xml on Load of the form
3. Click on “load valuelist” – the valuelist of the column is changed. If you click on “Load default layout” at this moment the previous saved valuelist will be displayed
4. Close the application – and the second valuelist will be saved in layout.xml
5. Rerun the application
6. Press “Yes” to “Load saved layout?” – the valuelist saved in layout.xml will be assigned to the column
Let me know if you have any questions.
there was no sample attached in your answer.
I tried to make a simpler sample than the one I posted before. What I want to do is saving and loading the layout automatically, but also give the user an option to load the default layout again, which I created at design time via the UltraGrid Designer (including the ValueLists!).
Please follow these steps to reproduce the problem:
As I described above, a workaround would be to set the ValueList property again. To test it, please uncomment line 33.