/// <summary> /// Displays AssociationEnds /// </summary> /// <param name="ends"></param> /// <param name="mc"></param> public void Display(IList <AssociationEnd> ends, ModelController mc) { IDictionaryEnumerator ie = stackPanel.Resources.GetEnumerator(); while (ie.MoveNext()) { if (ie.Key.ToString() == "changeLowerConverter") { changeLower = (ChangeLowerConverter)ie.Value; changeLower.modelController = mc; } else if (ie.Key.ToString() == "changeUpperConverter") { changeUpper = (ChangeUpperConverter)ie.Value; changeUpper.modelController = mc; } else if (ie.Key.ToString() == "changeRoleConverter") { changeRole = (ChangeRoleConverter)ie.Value; changeRole.modelController = mc; } } endsBox.DataContext = ends; }
/// <summary> /// Saves all unsaved values in the grid /// </summary> public override void UpdateContent() { foreach (TextBox t in endBoxes) { if (t.Name.Equals("lowerBox") && t.IsFocused && changeLower != null) { CheckCorrectMultiplicity(t, null); BindingExpression be = t.GetBindingExpression(TextBox.TextProperty); be.UpdateSource(); } else if (t.Name.Equals("upperBox") && t.IsFocused && changeUpper != null) { CheckCorrectMultiplicity(t, null); BindingExpression be = t.GetBindingExpression(TextBox.TextProperty); be.UpdateSource(); } else if (t.Name.Equals("roleBox") && t.IsFocused && changeRole != null) { BindingExpression be = t.GetBindingExpression(TextBox.TextProperty); be.UpdateSource(); } } changeLower = null; changeUpper = null; changeRole = null; endsBox.DataContext = null; endBoxes.Clear(); }