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
155
UltraTilePanel - LoadFromXml / SaveAsXml Not Persisting Tile Order Correctly
posted

I have an UltraTilePanel that allows the user to drag around a 3x3 grid of tiles in any order. I would like to persist this tile order in a settings file. I'm using SaveAsXml/LoadFromXml on the panel control and saving the XML string to a property in an enclosing XML settings file. The deserialization seems to be working correctly (no exceptions), but the tile order is not persisted correctly. Some tiles will be in the correct position as before, but others are out of place. Is this a known bug with the panel?

Here is my serialzation code:

 //Write the field tile order out to settings
                using (var memStream = new MemoryStream())
                {
                    ultraTilePanel1.SaveAsXml(memStream);
                    memStream.Position = 0;

                    using (var sr = new StreamReader(memStream))
                    {
                        pluginSettings.Add("FieldTileOrder", sr.ReadToEnd());
                    }
                }

And here is my deserialization code:

var tileLayout = pluginSettings["FieldTileOrder"];
                    using (var memStream = new MemoryStream())
                    {
                        using (StreamWriter sw = new StreamWriter(memStream))
                        {
                            sw.Write(tileLayout);

                            sw.Flush();
                            memStream.Position = 0;
                            ultraTilePanel1.LoadFromXml(memStream);
                        }
                    }

Parents Reply Children
No Data