Skip to content
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

MAIN: Update lists for better dynamic lists, pagination, async #150

Merged
merged 33 commits into from
Nov 12, 2024

Conversation

zadjii-msft
Copy link
Owner

Originally in #142 and #144, but github didn't automatically change the base branch 😨


As discussed in #77.

Biggest change is that IDynamicListPage doesn't have GetItems(String query) anymore. Instead, the host will call the SearchText setter, and the list can raise ItemsChanged to let the host know to call GetItems again

See src/modules/cmdpal/Exts/EverythingExtension/Pages/EverythingExtensionPage.cs for an example of how to update dynamic extensions.

Closes #131
Closes #77


  • I put the sample pages into a single top-level command, so deploying that extension didn't add 5 top-level commands to your palette
  • I tightened up some of the phrasing for the samples, and the builtins, to be less repetitive
  • I added a few icons
  • I made the markdown sample longer (and work more reliably)
  • and also thank you Hawker for auto-format on save, you the man

* I put the sample pages into a single top-level command, so deploying that extension didn't add 5 top-level commands to your palette
* I tightened up some of the phrasing for the samples, and the builtins, to be less repetitive
* I added a few icons
* I made the markdown sample longer (and work more reliably)
* and also thank you Hawker for auto-format on save, you the man

(targets #142)
@zadjii-msft zadjii-msft merged commit a41e7e7 into main Nov 12, 2024
zadjii-msft added a commit that referenced this pull request Nov 12, 2024
As discussed in #121. 

Adds a new `IListItem.TextToSuggest` property. If an extension populates that, and the user hits right-arrow when the item is selected, we'll set the `SearchText` to that text. 

I didn't give it a UI treatment, because 
1. I'm not good at XAML
2. As noted in #121 (comment), there's complicated edge cases here. You have to track what's actually been typed, and then also have a ghost suggestion for the very first item (before the user types/up/downs at all). 

I didn't think it was valuable to implement that right now before we have A Real App. 

* targets #144 
  * which targets #142 
    * which targets #141 

and those guys are all merged as of #150
Comment on lines +104 to +121
private ScrollViewer? FindScrollViewer(DependencyObject parent)
{
if (parent is ScrollViewer)
{
return (ScrollViewer)parent;
}

for (var i = 0; i < VisualTreeHelper.GetChildrenCount(parent); i++)
{
var child = VisualTreeHelper.GetChild(parent, i);
var result = FindScrollViewer(child);
if (result != null)
{
return result;
}
}

return null;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, we have helpers in the WCT for this, so if you're in C# never write these again 😋

ItemsList.FindAscendent<ScrollViewer>();

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh thank god 😅

This felt terribly dirty writing it, but it seemed like it was the only way to do it 🤷

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's in the CommunityToolkit.WinUI.Extensions package 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants