Keys.md
May 27, 2020 ยท View on GitHub
Keys are entered either directly after the extension name or using the Key property of the LocExtension class. Both will yield the same result (here with the key named Test):
<Button Content="{lex:Loc Test}" />
<Button Content="{lex:Loc Key=Test}" />
Automatic key retrieval
If the control already got or can get a value for its Name or x:Name property, the key may be neglected, provided, that a key exists that matches one of the following criteria (checked in exactly this order):
- ControlName_PropertyName
- ControlName
Using our button example we could imagine the following scenario:
<Button Name="MyButton" Content="{lex:Loc}" />
As no key was provided, the extension will first try to resolve a resource key named MyButton_Content. If this fails, it will then look for a resource key named MyButton. If this fails too, no value will be provided.
The separation character (default is underscore) can be individually set up for each control using the LocalizeDictionary.Separation property.