-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Description
Description of the new feature/enhancement
These are the follow-up works that worthen trying but are not blocking the Search project to be checked-in:
- The place holder text in the TextBox ("Find...") needs to be localizable.
- Search event should have a delegate with more args. This is illustrated below in Issue 2.
- Escape should be handled in the control too, as opposed to bubbling, this is illustrated in issue 3 below.
Proposed technical implementation details (optional)
Issue 2:
In the current implementation of search, case match and search direction information are stored in SearchBoxControl as Booleans and passed to TermControl through getter methods. Besides, "Shift + Enter" reverse search are implemented by temporarily change direction state value. These are not safe approaches and should be refactored.
One solution is to use a delegate.
delegate void SearchHandler(String query, Boolean forward, Boolean caseSensitive);
...
runtimeclass xxx {
event SearchHandler Search();
}
In this way, we do not have to create an object, and we do not even need to use TypedEventHandler.
Then, the consumer can still add a search handler like this:
searchBoxControl.Search([](hstring query, bool forward, bool caseSensitive) {
})
Issue 3:
TermControl is using PreviewKeyDown as the event handler for KeyDown events, which is applying a Tunneling strategy. In tunneling, the event will first received by the Root element in the XAML tree and then pass down to the element that triggers the event. Thus, an early return check is added in TermControl::_KeyDownHandler to make sure inputs from the search dialog is handled separately. However, it is worth trying if we can handle search dialog inputs in SearchBoxControl.
(Please make sure you mention all the extra work you've moved into this bug!)