Binding to static texts from An Infrastructure assembly

Topics: Prism v4 - WPF 4
Oct 10, 2012 at 12:41 PM
Edited Oct 10, 2012 at 12:55 PM

I want to bind the titles of the Views to static text's from our Infrastructure's Titles Class.
Adding a symbol prefix (e.g "Ref") and registering it's namespace and use it in the View
What I want is to achieve something similar to this :




<TextBlock Text="{Binding Titles.Title1}" />

Hopefully a way more similar to :
<TextBlock Text="{Binding Ref:Titles.Title1}" />
Please correct me.


namespace Xz.Infrastructure
    public class Titles
        public static string Title1 = "Title1";
        public static string RgnContent = "RgnContent";

Our Infrastructure isn't defined as a module, it's just an assembly.

Oct 10, 2012 at 2:57 PM
Edited Oct 10, 2012 at 2:57 PM


I believe you could try something like this:

<TextBlock Text="{x:Static Ref:Titles.Title1}"></TextBlock>

As you may find, a similar approach is used in the StockTrader RI for defining the region names in its RegionNames class, inside the Infrastructure project.

I hope you find this handy,

Agustin Adami

Oct 11, 2012 at 7:02 AM


That's right, I found that after I asked,