I pull my hair out. I created a class "employee.cs". I developed this class initially in the "public partial class Window1: Window" on "Window1.xaml.cs". By moving it to the sepate class, I can no longer refer to text fields, comboBoxes, etc. What should I do? The above error: "The name" textBox1 "does not exist in the current context." I am sure it is easy! Thanks guys!
Here is an example of reduction!
Window1.xaml
<Window x:Class="WpfApplication6.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300">
<Grid>
<TextBox Height="100" Margin="12,12,23,0" Name="textBox1" VerticalAlignment="Top" />
</Grid>
</Window>
Window1.xaml.cs
namespace WpfApplication6
{
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
textBox1.Text = "testing";
}
}
}
Class.cs
namespace WpfApplication6
{
class class1
{
public static void main()
{
textBox1.Text = "Help";
}
}
}
source
share