Constants in xaml

后端 未结 2 2100
情深已故
情深已故 2021-02-18 19:03

Let\'s say I have a class defined something like the below:

namespace MyProject.MyConstants
{
    public class Constants
    {
        public class Group1Constan         


        
2条回答
  •  有刺的猬
    2021-02-18 19:28

    For textbox label text field constants in XAML I use:

    Text="{x:Static local:[myConstantNamesClass].[name of constant string in your constant class]}" 
    

    and then need to build the solution to make it accessible.

    (Note that the local: XAML namespace would be set to reference the CLR namespace of the Constants class at the very top of the XAML file.)

提交回复
热议问题