XML version= "1.0" encoding= "UTF-8"?
> (1) Basic usage methods you can instantiate various objects in XAML, such as defining string constants in ResourceDictionary:
< ResourceDictionary xmlns = "Http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns : x = "Http://schemas.microsoft.com/winfx/2006/xaml" xmlns : system = "Clr-namespace:system;assembly=mscorlib" > < FontFamily x : Key = "uid_globalfont_family" > Microsoft Yahei </ FontFamily > < system : String x : Key = "Uid_refresh" > Refresh </ system : String > </ ResourceDictionary >
The above resource dictionary defines the string constant Uid_refresh, which is actually used in steps: 1. In the XAML used by resourcedictionary.mergeddictionariesImport the above resources
< usercontrol.resources > < ResourceDictionary > < resourcedictionary.mergeddictionaries > < ResourceDictionary Source = "/xxxxxxxxxxxxxxx;component/xxxxxxxxxxx.xaml"/> </ resourcedictionary.mergeddictionaries > </ResourceDictionary > </ usercontrol.resources >2. Refer to this string constant by DynamicResource or StaticResource < TextBlock Text ="{ DynamicResource Uid_refresh }" />
(2) Existing problems the definition of the above Uid_refresh has a space, the actual display but no space
(3) solve the method with & #160; replace the space.
< system : String x : Key = "Uid_refresh" > & #160; refresh& #160; </ system : String >
Copyright notice: This article Bo main original article, welcome reprint. Please sign only
XAML defines constants and processing space on string (chord)