title: How to call a method from another class in c#?
body: <p>In C#, I have a class with a method like this:</p>
  
  <pre><code>namespace ControlCenter
  {
      public partial class Canvas
      {
          ...
          public void display(string itemID)
          {
              ... // here assign some properties to the item
              this.Children.Add(item);
          }
      }
  }
  </code></pre>
  
  <p>This function allows me to add an item to my canvas successfully. Now I want to call this method in another different class like this:</p>
  
  <pre><code>namespace ControlCenter
  {
      public class addLayer
      {
          private ControlCenter.Canvas myCanvas = new ControlCenter.Canvas();
  
          public void add()
          {
              myCanvas.display("1234");
          }
      }
  }
  </code></pre>
  
  <p>But this cannot add any item to my canvas. By debugging, I doubt the problem should be in this line: </p>
  
  <pre><code>this.Children.Add(item);
  </code></pre>
  
  <p>When calling <code>display</code> method from <code>addLayer</code> class, <code>this</code> is not pointing to the active canvas I guess. But I couldn't find any solution even after mass internet search. Any help?</p>