Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

How to access the const variable in XAML file?

$
0
0

Hi all,

I have an const variable in a class, as following:

public class Names

{

public const string MyName = "test";

}

then I want to access the value in XAML, as following:

<Textblock Text="{MyName }"/>

the class Names is not the datacontext of the xaml, so how should I do?


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>