简体   繁体   中英

C# / XAML: How to declare a textbox in XAML code that is used in a class

How do I declare a textbox in the XAML code that is used in a class? I copied all the source code from the MainWindow.xaml.cs to another class because the MainWindow is getting to big.

I hope you can help me. Thanks in advance.

The following causes the error:

TextChanged="textBox_1_Kurzbeschreibung_TextChanged"

EDIT: The following statement solved the problem.

~closed.

Simple make the class partial, and then use the same name in the two classes.

public partial class MyClass
{
     // code....
}

The other class need to be equal:

public partial class MyClass
{
     // code....
}

From MSDN:

"Partial type definitions allow for the definition of a class, struct, or interface to be split into multiple files

See more here: http://msdn.microsoft.com/en-us/library/wbx7zzdd.aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM