private void OK_Click(object sender, RoutedEventArgs e) { IP.GetBindingExpression(TextBox.TextProperty).UpdateSource(); InfoPort.GetBindingExpression(TextBox.TextProperty).UpdateSource(); CommandPort.GetBindingExpression(TextBox.TextProperty).UpdateSource(); viewModel.SaveSettings(); isOpen = false; this.Close(); }
/// <summary> /// save chage made and update binding /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Save_Click(object sender, RoutedEventArgs e) { ViewModel vm = ViewModel.Instance; vm.Disconnect1(); vm.ChangeApp(IP.Text, Port.Text); BindingExpression ip_be = IP.GetBindingExpression(TextBox.TextProperty);//call to update IP.text field ip_be.UpdateSource(); BindingExpression Port_be = IP.GetBindingExpression(TextBox.TextProperty);//call to update Port.text field Port_be.UpdateSource(); vm.Connect(); this.Close(); }