This documentation is archived and is not being maintained.

BamlLocalizableResourceKey Class

Represents a key for a BamlLocalizableResource that is used to identify localizable resources.

Namespace:  System.Windows.Markup.Localizer
Assembly:  PresentationFramework (in PresentationFramework.dll)

public class BamlLocalizableResourceKey
You cannot directly create an instance of this class in XAML.

This class represents a key that can uniquely identify a localizable value inside binary XAML (BAML). It is represented as a combination of a Uid, class name, and property name.

The Uid value must be added to the source Extensible Application Markup Language (XAML) file either by using the "updateUid" Microsoft build engine (MSBuild) task (for example, msbuild /t:updateUid myproj.proj), or manually. BAML without a Uid cannot be localized. The class name is the type name of the element that contains the localizable property. Property name refers to the property that has the localizable value. A special property called "$Content" is used to represent values that are implicitly assigned to an element. For example:

<TextBlock x:Uid="myBlock">Click </TextBlock>

The following example demonstrates how to use a BamlLocalizableResourceKey.

// Obtain the BAML stream.
Stream source = entry.Value as Stream;

// Create a BamlLocalizer on the stream.
BamlLocalizer localizer = new BamlLocalizer(source);
BamlLocalizationDictionary resources = localizer.ExtractResources();

// Write out all the localizable resources in the BAML. 
foreach (DictionaryEntry resourceEntry in resources)
    BamlLocalizableResourceKey key = resourceEntry.Key as BamlLocalizableResourceKey;
    BamlLocalizableResource value = resourceEntry.Value as BamlLocalizableResource;
        "    {0}.{1}.{2} = {3}",


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0