public static void SetPasswordDisableSearchPaneOnFocusHandler(DependencyObject d, PasswordDisableSearchPaneOnFocusHandler value)
 {
     d.SetValue(PasswordDisableSearchPaneOnFocusHandlerProperty, value);
 }
        /// <summary>
        /// Handles changes to the DisableSearchPaneOnFocus property.
        /// </summary>
        /// <param name="d">
        /// The <see cref="DependencyObject"/> on which
        /// the property has changed value.
        /// </param>
        /// <param name="e">
        /// Event data that is issued by any event that
        /// tracks changes to the effective value of this property.
        /// </param>
        private static void OnDisableSearchPaneOnFocusChanged(
            DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            bool newDisableSearchPaneOnFocus = (bool)d.GetValue(DisableSearchPaneOnFocusProperty);

            var handler = GetPasswordDisableSearchPaneOnFocusHandler(d);

            if (handler != null)
            {
                handler.Detach();
                SetPasswordDisableSearchPaneOnFocusHandler(d, null);
            }

            if (newDisableSearchPaneOnFocus)
            {
                handler = new PasswordDisableSearchPaneOnFocusHandler((PasswordBox)d);
                SetPasswordDisableSearchPaneOnFocusHandler(d, handler);
            }
        }