Tony Allan

Tony Allan

  • NA
  • 71
  • 10.3k

Passing Class from Click event to function.

Jan 28 2017 3:22 PM

Hello,

I have a MainWindow with 2 buttons (AddWPF1, AddWPF2) and a Grid (Grid1).

I also have WindowWPF classes (WPFPage1, WPFPage2).

When I click AddWPF1 button I want an instance of the WPFPage1 with some details (WPFPage2 WPFPage, string formType, string contentname1, string textboxtext, string labelContent) to open in Grid1. And similar with the AddWPF2 button.

At present I can only use WPFPage1 or WPFPage2 (by changing the WPFPage1 or WPFPage2 in this line public void addFormToGrid(WPFPage1 WPFPage, string formType, string contentname1, string textboxtext, string labelContent).

I have attached a full working example with code with WFPPage2 button commented out so that it works.

Still getting my head around OOP so could someone please show me where I’m going wrong here.

Tony.


Attachment: ObjectTest.zip

Answers (5)