Reputation: 45105
How do I reference a type from a XAML style or template? The WPF syntax does not work in my Windows Store project.
The IDE barks at me with "Type is not supported in a Windows App project".
Upvotes: 4
Views: 5620
Reputation: 45105
Use the following syntax:
<Style TargetType="xmlNamespacePrefix:MyControlClassName" >
...
That is, you do not need to use the {x:Type } syntax in Windows Store and Phone apps.
MSDN says:
If you have used XAML for Windows Presentation Foundation (WPF), then you might have used an x:Type markup extension to fill in any XAML values that take a System.Type. The Windows Runtime XAML parser does not support x:Type. Instead, you should refer to the type by name without using any markup extension, and any necessary XAML-to-backing type conversion is already handled by the built-in conversion behavior in the XAML parser.
http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.style.targettype
Upvotes: 15