コード例 #1
0
        private static void OnTextPropertyChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
        {
            SearchTextBox stb = o as SearchTextBox;

            if (stb != null)
            {
                stb.UpdateSearchButtonIsEnabled();
            }
        }
コード例 #2
0
        private static void OnAllowEmptySearchesChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
        {
            SearchTextBox stb = o as SearchTextBox;
            bool          allowEmptySearches = (bool)e.NewValue;

            if (stb != null && stb._searchButtonHost != null)
            {
                if (allowEmptySearches)
                {
                    stb._searchButtonHost.IsEnabled = stb.Command?.CanExecute(stb.CommandParameter) ?? true;
                }
                else
                {
                    stb.UpdateSearchButtonIsEnabled();
                }
            }
        }