Ind*_*ore 4 xaml styles windows-8 .net-4.5 windows-store-apps
我想定义双值,以便我可以在很多中重用它 UIElements
<Double x:Key="MyWidth">100</Double>
<String x:Key="MyString">This is my text</String>
Run Code Online (Sandbox Code Playgroud)
它给了我错误Double is not supported in a Windows App project.,同样是字符串.
如果我包含xmlns:sys="using:System"在StandardStyles.xaml中,那么它正在编译.
<sys:Double x:Key="MyWidth">100</sys:Double>
<sys:String x:Key="MyString">This is my text</sys:String>
Run Code Online (Sandbox Code Playgroud)
它在运行时提供异常 XAML Parsing Failed. The type 'Double' was not found.
不需要包含System命名空间.
已经包含了一个命名空间xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
<x:Double x:Key="MyWidth">100</x:Double>
<x:String x:Key="MyString">This is my text</x:String>
Run Code Online (Sandbox Code Playgroud)