繁体   English   中英

如何访问属性APP.XAML.cs

[英]how to access in attribut APP.XAML.cs

我在类“ APP.XAML.cs”的同一项目中有类“ APP.XAML.cs”和其他类“ list.xaml.cs”。我有属性public static string ClientID {get; set;}在“ list.xaml.cs”中,我有方法clientInformation public void clientInformation(){IDClient = App。 ClientID;}(在此ligne IDClient = App.ClientID;中)。 我遇到了此错误应用程序“错误CS0119:'应用程序'est un类型,quis'est pasvalide dans le contextedonné”

 namespace Panels
    {//class App
        public partial class App : Application
        {
        public static string ClientID {get; set;}
         public App()
            {
                this.Startup += this.Application_Startup;
                this.Exit += this.Application_Exit;
                this.UnhandledException +=    
                this.Application_UnhandledException;
                InitializeComponent();            
            }
        }
     namespace Panels
    {//class list
        public partial class list : UserControl
        {
        public void clientInformation () { IDClient=App.ClientID; } 
       }

        }

您可以使用此示例:

((App)Application.Current).ClientID =1

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM