简体   繁体   中英

How can I bind the result from methode in a static class with parameters (only XAML)

I have a methode in a static class and this expected two parameters and return a string.

Now should I like from my View (without ViewModel) bind this result. Is this possible?

Pseudocode:

xmlns:lang="clr-namespace:LanguageModule;assembly=LanguageModule"

<TextBlock Text="{x:Static lang:Translate[firstParameter, secondParameter]}"/>

You might want to check out the ObjectDataProvider

Use the MethodName property to call a method and use the MethodParameters property to pass parameters to the method. You can then bind to the results of the method.

Here is an example article how to bind to a static method:

http://www.thomasclaudiushuber.com/blog/2008/01/10/bind-to-methods-with-objectdataprovider/

HTH

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM