1.2

Can I define a variable in XAML?

So this was possible in WPF and SL:

<Grid.Resources> <x:Double x:Name="MyDouble">1.2</x:Double> </Grid.Resources> 

But in WinRT-XAML, it simply emphasizes:

TypeConverter syntax error occurred while processing initialization string '1.2'

Does anyone know a trick to do this?

Decision

Use x: The key is not x: Name!

 <Grid.Resources> <x:Double x:Key="MyDouble">1.2</x:Double> </Grid.Resources> 
+4
source share
1 answer

I also get the following: "Type" Double "and" Value Types "in general cannot use x: Name"

If you switch from x: Name to x: Key - it works fine.

+2
source

Source: https://habr.com/ru/post/1440894/


All Articles