Divelements
Because everything starts with the presentation layer
Knowledge Base
 Sunday, October 01, 2006, 10:23 AM   Home Products Licensing Store Support Articles 

Support

Free Support

Customer Support
Manage Account
Manage Licenses
Product Downloads
Technical Support

I get an exception trying to persist layout information serialized in a different locale.
Home / Support / Knowledge Base

Product: SandDock
Published: Thursday, January 27, 2005

This happens because different locales have different methods for expressing numerical values in string form. For example, in an English locale a size gets persisted as "123, 456" and in a German locale the same size gets persisted as "123; 456". If your application requires that serialized layouts work across different locales, it is recommended that you switch the current locale on the thread from which you are storing and retrieving layouts.

Code examples for saving and loading layouts while switching temporarily to the en-US locale are below.

// Saving a layout to a textbox, temporarily switching to the en-US locale
System.Globalization.CultureInfo oldCulture = System.Threading.Thread.CurrentThread.CurrentCulture;
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
textBox1.Text = sandDockManager1.GetLayout();
System.Threading.Thread.CurrentThread.CurrentCulture = oldCulture;

// Loading a layout from a textbox, temporarily switching to the en-US locale
System.Globalization.CultureInfo oldCulture = System.Threading.Thread.CurrentThread.CurrentCulture;
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
sandDockManager1.SetLayout(textBox1.Text);
System.Threading.Thread.CurrentThread.CurrentCulture = oldCulture;
                
Design and content Copyright © 2003 - 2006 Divelements Limited. Content may not be reproduced without permission.