Find button is only enabled after I expand the find options

SyntaxEditor for WPF Forum

Posted 10 years ago by Gustavo Guerra
Version: 9.1.0500
Avatar
When using the EditorSearchView in Find mode, the find button is only enabled after I expand the Find Options the first time. When in Replace mode it works ok and it enables it as soon as both textboxes are filled. How can I fix that? I'm using the following code:

var window = new Window {
Title = "Quick Find in " + parentWindow.Title,
SizeToContent = SizeToContent.WidthAndHeight,
ResizeMode = ResizeMode.NoResize,
Owner = parentWindow,
ShowInTaskbar = false,
WindowStartupLocation = WindowStartupLocation.CenterOwner,
Content = new EditorSearchView {
SyntaxEditor = Owner,
Mode = EditorSearchMode.Find,
IsModeToolBarVisible = true,
IsOptionsPanelExpanded = false,
SearchOptions = new EditorSearchOptions {
MatchCase = false,
MatchWholeWord = false,
Scope = EditorSearchScope.Document,
PatternProvider = SearchPatternProviders.Normal,
},
},
};

window.Show();

Best Regards,
Gustavo Guerra

Comments (5)

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Gustavo,

The buttons are driven by commands. However the EditorSearchView itself handles the commands, so my guess is that the problem here has something to do with either FindText not being filled in on the search options yet, or WPF focus and how that affects command routing.

Here is the command handling code to determine if the Find button is enabled:
e.CanExecute = (control.SyntaxEditor != null) && (searchOptions != null) && (!string.IsNullOrEmpty(searchOptions.FindText));
If that info doesn't help, please email over a simple sample project that shows the issue and we'll take a look.

[Modified at 06/15/2009 02:29 PM]


Actipro Software Support

Posted 10 years ago by Bradley
Avatar
Actually, mine's doing the same thing but the issue is its not behaving like it would in say VS. You have to bring up your search box and type in something and then you have to give the focus to something else for some reason.

Example:
Bring up search box
Type in the letter "a" into "Find What".
Find Next SHOULD be enabled as soon as there's a character typed into the textbox.
What actually happens is you have to click on something else, or just hit tab, for the box to be enabled.

If you go to quick replace and type something into the "find what" box and tab to "replace with" all 3 buttons are now enabled.
Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Bradley,

If you can put together a simple sample project that shows this and email it over, we may be able to resolve the issue before our upcoming maintenance release (which is hopefully in the next several days). Thanks!


Actipro Software Support

Posted 10 years ago by Bradley
Avatar
Actually just open up the c# version of the sample browser code, go to the SearchFindResults project, open up the xaml and chnage your search options to

    <UserControl.Resources>
        
        <!-- Search options -->
        <editor:EditorSearchOptions x:Key="EditorSearchOptions" FindText="" ReplaceText="" 
                                    PatternProvider="{x:Static textSearching:SearchPatternProviders.RegularExpression}" />
        
    </UserControl.Resources>
FindText and ReplaceText are now empty strings, that's the only difference. It seems to work if you put some data in both of those, but personally I'd like to my search box to be empty when the user opens it.
Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Bradley,

Thanks for the repro steps. We needed to tweak the binding on the textbox to update on property changed. After doing that, it works great. This will be in the next maintenance release, coming soon.


Actipro Software Support

The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.