diff --git a/EditTextBlock/EditableTextBlock.cs b/EditTextBlock/EditableTextBlock.cs
deleted file mode 100644
index 57c1a02..0000000
--- a/EditTextBlock/EditableTextBlock.cs
+++ /dev/null
@@ -1,135 +0,0 @@
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-
-namespace GeekDesk.EditTextBlock
-{
- public class EditableTextBlock : TextBlock
- {
- public bool IsInEditMode
- {
- get
- {
- return (bool)GetValue(IsInEditModeProperty);
- }
- set
- {
- SetValue(IsInEditModeProperty, value);
- }
- }
-
- private EditableTextBlockAdorner _adorner;
-
- // Using a DependencyProperty as the backing store for IsInEditMode. This enables animation, styling, binding, etc...
- public static readonly DependencyProperty IsInEditModeProperty =
- DependencyProperty.Register("IsInEditMode", typeof(bool), typeof(EditableTextBlock), new UIPropertyMetadata(false, IsInEditModeUpdate));
-
- ///
- /// Determines whether [is in edit mode update] [the specified obj].
- ///
- /// The obj.
- /// The instance containing the event data.
- private static void IsInEditModeUpdate(DependencyObject obj, DependencyPropertyChangedEventArgs e)
- {
- EditableTextBlock textBlock = obj as EditableTextBlock;
- if (null != textBlock)
- {
- //Get the adorner layer of the uielement (here TextBlock)
- AdornerLayer layer = AdornerLayer.GetAdornerLayer(textBlock);
-
- //If the IsInEditMode set to true means the user has enabled the edit mode then
- //add the adorner to the adorner layer of the TextBlock.
- if (textBlock.IsInEditMode)
- {
- if (null == textBlock._adorner)
- {
- textBlock._adorner = new EditableTextBlockAdorner(textBlock);
-
- //Events wired to exit edit mode when the user presses Enter key or leaves the control.
- textBlock._adorner.TextBoxKeyUp += textBlock.TextBoxKeyUp;
- textBlock._adorner.TextBoxLostFocus += textBlock.TextBoxLostFocus;
- }
- layer.Add(textBlock._adorner);
- }
- else
- {
- //Remove the adorner from the adorner layer.
- Adorner[] adorners = layer.GetAdorners(textBlock);
- if (adorners != null)
- {
- foreach (Adorner adorner in adorners)
- {
- if (adorner is EditableTextBlockAdorner)
- {
- layer.Remove(adorner);
- }
- }
- }
-
- //Update the textblock's text binding.
- BindingExpression expression = textBlock.GetBindingExpression(TextProperty);
- if (null != expression)
- {
- expression.UpdateTarget();
- }
- }
- }
- }
-
- ///
- /// Gets or sets the length of the max.
- ///
- /// The length of the max.
- public int MaxLength
- {
- get
- {
- return (int)GetValue(MaxLengthProperty);
- }
- set
- {
- SetValue(MaxLengthProperty, value);
- }
- }
-
- // Using a DependencyProperty as the backing store for MaxLength. This enables animation, styling, binding, etc...
- public static readonly DependencyProperty MaxLengthProperty =
- DependencyProperty.Register("MaxLength", typeof(int), typeof(EditableTextBlock), new UIPropertyMetadata(0));
-
- private void TextBoxLostFocus(object sender, RoutedEventArgs e)
- {
- IsInEditMode = false;
- }
-
- ///
- /// release the edit mode when user presses enter.
- ///
- /// The sender.
- /// The instance containing the event data.
- private void TextBoxKeyUp(object sender, KeyEventArgs e)
- {
- if (e.Key == Key.Enter)
- {
- IsInEditMode = false;
- }
- }
-
- ///
- /// Invoked when an unhandled attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.
- ///
- /// The that contains the event data. This event data reports details about the mouse button that was pressed and the handled state.
- protected override void OnMouseDown(MouseButtonEventArgs e)
- {
- if (e.MiddleButton == MouseButtonState.Pressed)
- {
- IsInEditMode = true;
- }
- else if (e.ClickCount == 2)
- {
- IsInEditMode = true;
- }
- }
- }
-}
\ No newline at end of file
diff --git a/EditTextBlock/EditableTextBlockAdorner.cs b/EditTextBlock/EditableTextBlockAdorner.cs
deleted file mode 100644
index 3c76bbb..0000000
--- a/EditTextBlock/EditableTextBlockAdorner.cs
+++ /dev/null
@@ -1,101 +0,0 @@
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-
-namespace GeekDesk.EditTextBlock
-{
- ///
- /// Adorner class which shows textbox over the text block when the Edit mode is on.
- ///
- public class EditableTextBlockAdorner : Adorner
- {
- private readonly VisualCollection _collection;
-
- private readonly TextBox _textBox;
-
- private readonly TextBlock _textBlock;
-
- public EditableTextBlockAdorner(EditableTextBlock adornedElement)
- : base(adornedElement)
- {
- _collection = new VisualCollection(this);
- _textBox = new TextBox();
- _textBlock = adornedElement;
- Binding binding = new Binding("Text") { Source = adornedElement };
- _textBox.SetBinding(TextBox.TextProperty, binding);
- _textBox.AcceptsReturn = true;
- _textBox.MaxLength = adornedElement.MaxLength;
- _textBox.KeyUp += _textBox_KeyUp;
- _collection.Add(_textBox);
- }
-
- void _textBox_KeyUp(object sender, KeyEventArgs e)
- {
- if (e.Key == Key.Enter)
- {
- _textBox.Text = _textBox.Text.Replace("\r\n", string.Empty);
- BindingExpression expression = _textBox.GetBindingExpression(TextBox.TextProperty);
- if (null != expression)
- {
- expression.UpdateSource();
- }
- }
- }
-
- protected override Visual GetVisualChild(int index)
- {
- return _collection[index];
- }
-
- protected override int VisualChildrenCount
- {
- get
- {
- return _collection.Count;
- }
- }
-
- protected override Size ArrangeOverride(Size finalSize)
- {
- _textBox.Arrange(new Rect(0, 0, _textBlock.DesiredSize.Width + 50, _textBlock.DesiredSize.Height * 1.5));
- _textBox.Focus();
- return finalSize;
- }
-
- protected override void OnRender(DrawingContext drawingContext)
- {
- drawingContext.DrawRectangle(null, new Pen
- {
- Brush = Brushes.Gold,
- Thickness = 2
- }, new Rect(0, 0, _textBlock.DesiredSize.Width + 50, _textBlock.DesiredSize.Height * 1.5));
- }
-
- public event RoutedEventHandler TextBoxLostFocus
- {
- add
- {
- _textBox.LostFocus += value;
- }
- remove
- {
- _textBox.LostFocus -= value;
- }
- }
-
- public event KeyEventHandler TextBoxKeyUp
- {
- add
- {
- _textBox.KeyUp += value;
- }
- remove
- {
- _textBox.KeyUp -= value;
- }
- }
- }
-}
diff --git a/GeekDesk.csproj b/GeekDesk.csproj
index 7a3cd03..1ef5186 100644
--- a/GeekDesk.csproj
+++ b/GeekDesk.csproj
@@ -166,8 +166,6 @@
-
-
diff --git a/MainWindow.xaml b/MainWindow.xaml
index 207aaff..9fb8ec4 100644
--- a/MainWindow.xaml
+++ b/MainWindow.xaml
@@ -4,7 +4,6 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:GeekDesk"
- xmlns:tp="clr-namespace:GeekDesk.EditTextBlock"
xmlns:uc="clr-namespace:GeekDesk.Control.UserControls.PannelCard"
mc:Ignorable="d"
xmlns:cvt="clr-namespace:GeekDesk.Converts"