Home > Net >  Could you tell me how to visit each other between Page in the WPF controls?
Could you tell me how to visit each other between Page in the WPF controls?

Time:09-15

My current design structure is
MainWindow
- BasePage
-- -- -- -- -- Page1
-- -- -- -- -- Page2

I currently have in BasePage statement handle of each Page.
 
Public WebInfoPage _wiPage;
Public DictPage _dicPage;


And in the WebInfoPage constructor..
 
Enclosing _wiPage=this;


But I'm DictPage calls this. _wiPage of certainty is NULL..

How to visit each other between the WPF, please Page Page controls??????

CodePudding user response:

You didn't give this. _wiPage assignment,

CodePudding user response:

To make clear the scope of the variable,

CodePudding user response:

I put _wiPage BasePage. Other Page are inherited from BasePage. WebInfoPage in subclass constructor has been assigned to this. _wiPage...
If this method is not used, are there any other way?

CodePudding user response:

The need to manipulate the process of packaging into an external method, or consider the ViewModel operation

CodePudding user response:

reference 4 floor ziqi0716 response:
encapsulate need operation process into a method of foreign or consider operation ViewModel

Now the main problem is in a page for less than the waist operation in the class of page object,

CodePudding user response:

X: Name

CodePudding user response:

reference 5 floor shaw118 reply:
Quote: refer to 4th floor ziqi0716 response:
encapsulate need operation process into a method of foreign or consider operation ViewModel

Now the main problem is in a page for less than the waist operation in the class of page object,

Each page class make a static Instance attributes, used to store the last instantiated object, through the Instance will be able to get to, that you can learn the design pattern, singleton pattern, for example, the factory pattern.
Ah, there are 10000 ways to achieve

CodePudding user response:

Enclosing _wiPage=this;
This statement is confusing, intention is what?
  •  Tags:  
  • C#
  • Related