簡體   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