public newEmployee() { InitializeComponent(); // Edit Employee if (Application.Current.Properties["mit_edit_id"] != null) { int mit_id; var bool5 = Int32.TryParse(Application.Current.Properties["mit_edit_id"].ToString(), out mit_id); Mitarbeiter mit = Bibliothek.Mitarbeiter_nach_ID(mit_id); this.mitName.Text = mit.Name; this.mitVorname.Text = mit.Vorname; this.mitAktiv.IsChecked = mit.IstAktiv; this.mitSubmit.Tag = "edit"; // Create hidden button to save employee id this.btnID.Tag = mit_id.ToString(); // Edit window opened and loaded.. reset trigger property Application.Current.Properties["mit_edit_id"] = null; } }