Such as
C=new UserControl1 MyUserControl () {Content=new Grid ()};
Var f=c.I sInitialized;//is true
Var BTN=FindChildren
The Debug. Print (" name: "+ b.N ame);
B.N ame="TTT";
}
With FindName (... ) there is no effect, (looking for custom controls child controls, and is in the child controls without InitializeComponent part),
Such as:
Public UserControl1 ()
{
//InitializeComponent ();
The Grid GridContainer=new Grid () {Name="yy9999"};
Var n=GridContainer. FindName (" yy9999 ");//is NULL
Or System. Windows. NameScope. SetNameScope (GridContainer, the new System. Windows. NameScope ());
RegisterName (" GGG ", GridContainer);//an error,,,, because there is no InitializeComponent ()?
CodePudding user response:
That is://InitializeComponent ();=> InitializeComponent ();In addition, there is no MVVM to write WPF, you will be very tired, feeling a lot of things are bad