KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a ResourceDictionary that contains strings: <ResourceDictionary xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:sys="clr-namespace:System;assembly=mscorlib"> <sys:String x:Key="Foo">Hello world</sys:String> ... </ResourceDictionary> This dictionary is part of a theme, and in some themes, some of the strings are empty: <sys:String x:Key="Foo"></sys:String> The trouble is that in that case, I get a XamlParseException : Cannot create object of type 'System.String'. CreateInstance failed, which can be caused by not having a public default constructor for 'System.String' I know it is possible to declare an empty string in an array resource, using <x:Static Member="sys:String.Empty" /> , but I don't want an array... Using x:Static directly as the resource returns the markup extension, not the string. Putting x:Static in the sys:String element gives the same error as before. Is it even possible to declare an empty string as an XAML resource? How?
Tags (comma-separated)
Save Edits
Cancel