Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6364341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:09:04+00:00 2026-05-25T00:09:04+00:00

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>

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T00:09:05+00:00Added an answer on May 25, 2026 at 12:09 am

    Declaring it using x:Static seems to work just fine for me…

    <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                        xmlns:local="clr-namespace:Test"
                xmlns:sys="clr-namespace:System;assembly=mscorlib">
        <x:Static x:Key="empty" Member="sys:String.Empty" />
    </ResourceDictionary>
    
     cc.Content = (string)FindResource("empty"); //Casts to string without exception
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a XAML Window that has a set of strings that are bound
I have installed Entypo package using NuGet . I got Icons.xaml file that contains
In Silverlight, I have a xaml page that contains a resource dictionary defining many
I have a Resources.xaml file that contains a Storyboard targeted at a control named
Ok, I have a ResourceDictionary definition that I used for a WPF app below:
I have an application that uses a ResourceDictionary to set the styles, which it
I have a lot of styles in ResourceDictionary. For example like that: <Style TargetType={x:Type
I have a custom UserControl that contains a grid ...I wish to set the
In my MainWindow.xaml, I have the following reference to a ResourceDictionary: <Window.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries>
I Have a ResourceDictionary Generic.xaml which consists of a set of other resource dictionaries,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.