I have a static class in a common project where I have all my property with all my text (for example, all my titles)
I want to know how I can bind my TextBlock Text to this value.
I tried Text={x:Static...} but Static is not found.
Thanks
{x:static...} is not present in UWP.
You can still do something similar, but the class itself must not be static. The properties in the class can be static but you need to create an instance of that class. So you will need to ask for a change in the core lib.
Then you declare that class as a resource and use that as the source of your Bindings. I recommend you declare the resource where it's globally available, like app.xaml.
<Application.Resources>
<lib:Class1 x:Key="c1"/>
</Application.Resources>
...
<TextBlock Text="{Binding Source={StaticResource c1}, Path=Text1}" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With