private static void OnIsSelectableChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            SearchableTextControl obj = d as SearchableTextControl;

            obj.ResetSelectionTextRange();
            obj.Cursor = obj.IsSelectable ? Cursors.IBeam : Cursors.Arrow;
        }
        /// <summary>
        /// Create a call back function which is used to invalidate the rendering of the element,
        /// and force a complete new layout pass.
        /// One such advanced scenario is if you are creating a PropertyChangedCallback for a
        /// dependency property that is not  on a Freezable or FrameworkElement derived class that
        /// still influences the layout when it changes.
        /// </summary>
        private static void UpdateControlCallBack(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            SearchableTextControl obj = d as SearchableTextControl;

            obj.InvalidateVisual();
        }