-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding Controls Search Bar #661
base: main
Are you sure you want to change the base?
Conversation
initializeMapping(); | ||
} | ||
|
||
private void initializeMapping() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't do it this way. There is a ControlsInfoData.json, which is to be used to get the list of all the controls and pages. Use that.
This will reintroduce the redundancy of data.
@@ -1,5 +1,6 @@ | |||
using System.Collections; | |||
using System.Windows.Navigation; | |||
using WPFGallery.Views; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Navigation Service should not depend on the Views, IMO.
{ | ||
var comboBox = sender as ComboBox; | ||
|
||
comboBox.IsDropDownOpen = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the behavior when we navigate on the drop down using arrow keys ? For A11y, we will have to avoid selection, but I am guessing that's working correctly. I will try to run the changes and check it out. Overall, good work.
@@ -12,6 +12,39 @@ public partial class MainWindowViewModel : ObservableObject | |||
[ObservableProperty] | |||
private string _applicationTitle = "WPF Gallery Preview"; | |||
|
|||
private ObservableCollection<string> SearchItems { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the need for search items ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It contains the list of all pages in string format. This is then used to filter out from this whole set without changing the original FilteredSearchItems.
} | ||
} | ||
|
||
private void FilterItems() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should go in ControlsInfoDataSource.cs .
|
||
SearchItems = new(); | ||
|
||
foreach (ControlInfoDataItem mainPage in Controls) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even this should go in ControlsInfoDataSource.cs
Reasoning being, it is not related to MainWindow, and it may be needed by multiple viewmodels.
Fixes: #633
The following changes adds a search bar in WPF gallery, to check find controls.
Microsoft Reviewers: Open in CodeFlow