SetValue<Matrix>() bug

    General discussion

  • Bug in MatrixTransform.Matrix.set property:

    Matrix matrix= new Matrix( 1.5, 0, 0, 1.5, 0, 0 ); // simple scale

    MatrixTransform mt= new MatrixTransform();
    mt.Matrix= matrix; // BUG, not properly serialized to the Silverlight native engine

    The problem comes from the fact that a Matrix is converted to text using Matrix.ToString() in XcpImports.SetValue<T>(). If Regional Settings are set to "French", then the decimal (NumberDecimalSeparator) is a comma (",") not a dot (".").

    Therefore, instead of passing the string "1.5,0,0,1.5,0,0" (6 numbers) to the Silverlight engine, the framework is passing "1,5,0,0,1,5,0,0" (8 numbers, invalid matrix):

    // text = "1,5,0,0,1,5,0,0" instead of "1.5,0,0,1.5,0,0"
    string text= matrix.ToString();

    BTW,  could someone tell me a workaround : how to I change the current culture in runtime with Silverlight .NET ?



    Tuesday, May 22, 2007 10:16 AM

All replies