/// <summary>
        ///   Event handler for MouseUp event on an EditableTextBlock.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void EditableTextBlockMouseUp(object sender, MouseButtonEventArgs e)
        {
            var editableTextBlock = sender as EditableTextBlock;

            if (editableTextBlock == null)
            {
                return;
            }

            // create a timer to wait for the system default
            // doubleclick time to see if we have a double click or not.
            DispatcherTimer timer = new DispatcherTimer(DispatcherPriority.Normal, Dispatcher);

            // we use the windows forms SystemInformation class as it's easier to work with than p/invoke
            timer.Interval = new TimeSpan(0, 0, 0, 0, SystemInformation.DoubleClickTime);

            timer.Tick += delegate
                              {
                                  timer.Stop();

                                  if (_dcCounter > 0)
                                  {
                                      _dcCounter--;
                                      return;
                                  }

                                  if (_lastClicked == editableTextBlock)
                                  {
                                      editableTextBlock.IsEditable = true;
                                  }
                                  else
                                  {
                                      _lastClicked = editableTextBlock;
                                      editableTextBlock.Focus();
                                  }

                                  return;
                              };
            timer.Start();
        }
 /// <summary>
 ///   Event handler for MouseDoubleClick event on EditableTextBlock.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void EditableTextBlockMouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     _dcCounter+=2;
     _lastClicked = sender as EditableTextBlock;
 }