The member “CurrentCulture” is not recognized or is not accessible

前端 未结 3 1166
轮回少年
轮回少年 2021-01-07 21:50

I have a Window with the following namespace

xmlns:sysglb=\"clr-namespace:System.Globalization;assembly=mscorlib\"

that contains a textbox

3条回答
  •  感情败类
    2021-01-07 22:29

    Can't remember where I got this from but it works

    using System.Globalization;
    using System.Windows.Data;
    
    namespace SomeNamespace
    {
        /// 
        /// This class is a fudge because
        /// 
        ///         xmlns:sysglb="clr-namespace:System.Globalization;assembly=mscorlib"
        ///         
        ///         
        /// 
        ///     is giving 
        ///             Error 29    "The member "CurrentCulture" is not recognized or is not accessible."
        /// 
        /// Instead we use
        /// 
        ///         
        /// 
        /// 
        public class CultureAwareBinding : Binding
        {
            public CultureAwareBinding()
            {
                ConverterCulture = CultureInfo.CurrentCulture;
            }
        }
    }
    

提交回复
热议问题