タイトルは私の質問です。以下に説明します。
私はvs2010であるwpfアプリケーションに取り組んでいます。2 つのウィンドウがあります。1 つは MainWindow で、もう 1 つは fileList ウィンドウです。私の fileList ウィンドウには、クリックするとファイルが読み込まれるファイルのリストがあります。onClick メソッドは fileList クラスに実装されています。ファイルをロードする関数は MainWindow 部分クラスに実装されています。
ウィンドウを表示するために MainWindow クラスでインスタンス化された私の fileList クラス。MainWidow を再度インスタンス化することはできません。MainWindow の関数 (メソッド) は、静的に宣言できない (方法がわからない) 他のパラメーターを使用しているため、静的に宣言できません。
以下に関連するコードを貼り付けます。親切に助けてください。
namespace test
{
  public partial class MainWindow : Window
     fileList fl = new fileList;
     public MainWindow()
     {
      InitializeComponent();
      fl.show();
      }
      public void porcessfile(string path)
      {
       //this method processes the the file at "path". It uses combobox and scrollviewer 
       //declared in xaml. I dont know how to declare static in xaml, else I will declare       
       //them static and change the whole method to static, so I can call it without  
       //instantiating. I tried making a nested-class, but then I can't  access variable 
       //declared in MainWindow (parent) class. Or there is a way to do that?
      }
}
そして他のクラス:
namespace test
{
  public partial class fileList : Window
  {
     public fileList()
     {
        IntializeComponent();
     }
     private void Button_click(object sender, RoutedEventsArgs e)
     {
      //code that gets "path" on click, works fine.
      processfile(string path); // what and how to do here.
     }
  }
} 
私がはっきりしていることを心から願っています。必要に応じて詳細をお尋ねください。