Get values from *.resx files in XAML

前端 未结 7 2075
攒了一身酷
攒了一身酷 2020-11-30 23:24

Is it possible to add some value from resource file right into the XAML markup? Or for localization we always have to make something like this in *.cs file:

         


        
7条回答
  •  北荒
    北荒 (楼主)
    2020-12-01 00:04

    The simplest way is probably to reference the items directly (they are static properties, internal by default):

    
    

    If you are working on a localised WPF app though then I'd recommend taking a look at the guidance on CodePlex at http://wpflocalization.codeplex.com/ , and if you're building a composite app (using PRISM or MEF) then I have a blog post on a nice way to accomplish WPF localisation using standard bindings.

提交回复
热议问题