Silverlight XAML BUG

前端 未结 1 1583
Happy的楠姐
Happy的楠姐 2020-12-19 19:44

Why if I put this into a xaml dictionary used under Silverlight the compiler founds an error.



        
1条回答
  •  执笔经年
    2020-12-19 20:13

    I assume the error you're getting is something like the following:

    Failed to create a 'System.Byte' from the text '255'

    The XAML parser in Silverlight only knows how to handle doubles, ints and bools. The properties A, R, G and B in the Color struct are all bytes, which the Silverlight XAML parser doesn't know how to handle. The XAML parser in WPF, on the other hand, does know how to handle these values, so that's why you're not getting an error in WPF.

    The MSDN documentation for the Color struct lists a number of ways to create a Color value in XAML in Silverlight.

    A similar question was asked a while ago about why floats can't be used in XAML in Silverlight either.

    0 讨论(0)
提交回复
热议问题