简体   繁体   English

如何访问属性APP.XAML.cs

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

I have class "APP.XAML.cs" and other class "list.xaml.cs" in the same project in class "APP.XAML.cs"I have attribute public static string ClientID {get; 我在类“ APP.XAML.cs”的同一项目中有类“ APP.XAML.cs”和其他类“ list.xaml.cs”。我有属性public static string ClientID {get; set;} in the "list.xaml.cs" I have method clientInformation public void clientInformation () {IDClient=App. set;}在“ list.xaml.cs”中,我有方法clientInformation public void clientInformation(){IDClient = App。 ClientID;} in this ligne IDClient=App.ClientID; ClientID;}(在此ligne IDClient = App.ClientID;中)。 I have this error App "error CS0119: 'App' est un type, qui n'est pas valide dans le contexte donné" 我遇到了此错误应用程序“错误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