Question

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.

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top