mardi 12 avril 2016

C# passing canvas from XAML to another class not using constructor

Is there any way to pass a canvas not directly form MainWindow class to another class not using constructor or setter? What I mean is:

class MainWindow{
   public MainWindow(){
    // here we got our canvas property
   }
}

public interface IDraw{
   void draw(Canvas c);
}

class Map : IDraw{

   public Map(){
     draw(/*canvas*/);
   }
   void draw(Canvas c){

   }
}

Unfortunately on my way stands a factory creating Map. I've no way to modify this. Any solutions?

Aucun commentaire:

Enregistrer un commentaire