How to define primitives in StandardStyles.xaml

I want to define double values ​​so that I can reuse it in many UIElements

 <Double x:Key="MyWidth">100</Double> <String x:Key="MyString">This is my text</String> 

This gives me the error Double is not supported in a Windows App project. as well as for the string.

And if I include xmlns:sys="using:System" in StandardStyles.xaml, then it compiles.

 <sys:Double x:Key="MyWidth">100</sys:Double> <sys:String x:Key="MyString">This is my text</sys:String> 

It throws an exception at runtime XAML Parsing Failed. The type 'Double' was not found. XAML Parsing Failed. The type 'Double' was not found.

+4
source share
1 answer

There is no need to include the System namespace.
Xmlns is already included in the namespace 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> 
+6
source

All Articles