开发者

How to use resources from ResourceManager in WPF binding

开发者 https://www.devze.com 2023-04-06 23:52 出处:网络
Is there any good tutorial on how to use Resource开发者_StackOverflowManager in WPF binding ? I know how to use it with the GetString function to retrieve a specific resource, but I also would like to

Is there any good tutorial on how to use Resource开发者_StackOverflowManager in WPF binding ? I know how to use it with the GetString function to retrieve a specific resource, but I also would like to use in in binding.

something like

<TextBlock Text="{Binding Resource.EnterName}"/>

thanks


A binding would not do much except getting the value once as the resources do not provide any notifications as far as i know. You can get the values using x:Static, e.g.:

<TextBlock xmlns:prop="clr-namespace:AppAssemblyName.Properties"
           Text="{x:Static prop:Resources.ResourceName}"/>

(The resource's accessors need to be set to public)

0

精彩评论

暂无评论...
验证码 换一张
取 消