public MainWindow() { InitializeComponent(); ProcType = eProcType.ProcString; txtFormula.DataContext = this; txtResult.DataContext = this; DataContext = this; var prefs = new UserPreferences(); this.Height = prefs.WindowHeight; this.Width = prefs.WindowWidth; this.Top = prefs.WindowTop; this.Left = prefs.WindowLeft; this.WindowState = prefs.WindowState; }