Browse Source

Fix bug which caused the edited text to be invisible on clicking outside the element.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/wpfdesigner@5923 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
pull/1/head
Kumar Devvrat 16 years ago
parent
commit
fd598d1ea5
  1. 18
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/InPlaceEditor.cs

18
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/InPlaceEditor.cs

@ -53,12 +53,12 @@ namespace ICSharpCode.WpfDesign.Designer.Controls @@ -53,12 +53,12 @@ namespace ICSharpCode.WpfDesign.Designer.Controls
}
public override void OnApplyTemplate()
{
{
base.OnApplyTemplate();
editor = new TextBox();
editor = Template.FindName("editor", this) as TextBox; // Gets the TextBox-editor from the Template
Debug.Assert(editor != null);
}
}
/// <summary>
/// Binds the Text Property of the element extended with <see cref="Bind"/>.
@ -90,25 +90,27 @@ namespace ICSharpCode.WpfDesign.Designer.Controls @@ -90,25 +90,27 @@ namespace ICSharpCode.WpfDesign.Designer.Controls
}
protected override void OnGotKeyboardFocus(KeyboardFocusChangedEventArgs e)
{
{
base.OnGotKeyboardFocus(e);
changeGroup = designItem.OpenGroup("Change Text");
editor.Focus();
}
}
protected override void OnLostKeyboardFocus(KeyboardFocusChangedEventArgs e)
{
{
if (changeGroup != null)
changeGroup.Abort();
if (textBlock != null)
textBlock.Visibility = Visibility.Visible;
base.OnLostKeyboardFocus(e);
}
}
/// <summary>
/// Change is committed if the user releases the Escape Key.
/// </summary>
/// <param name="e"></param>
protected override void OnKeyUp(KeyEventArgs e)
{
{
base.OnKeyUp(e);
if (e.Key == Key.Escape) {
// Commit the changes to the DOM
@ -126,6 +128,6 @@ namespace ICSharpCode.WpfDesign.Designer.Controls @@ -126,6 +128,6 @@ namespace ICSharpCode.WpfDesign.Designer.Controls
this.Visibility = Visibility.Hidden;
textBlock.Visibility = Visibility.Visible;
}
}
}
}
}

Loading…
Cancel
Save