CmdPal: Implement IDetailsCommand in details (#39911)

Implemented IDetailsCommands in details. This will close #38339.

This works very similar to Tags in that it is a list of commands. This
was done to allow for styling without the 12 spacing of the
ItemsRepeater and looks like you'd find in the OS-inbox like:


![image](https://github.com/user-attachments/assets/97ee1952-13bb-4c8b-a074-0347b04e0c2c)


![image](https://github.com/user-attachments/assets/8f6f1f72-4ea0-441d-893e-ae26aabdc922)

Also added to our sample extension:


![image](https://github.com/user-attachments/assets/ab3ce521-3479-448f-b4d6-9dfd09feb24f)
This commit is contained in:
Michael Jolley
2025-06-05 08:56:13 -05:00
committed by GitHub
parent 78b29c5b66
commit bf9217ec24
8 changed files with 112 additions and 4 deletions

View File

@@ -5,6 +5,7 @@
using System;
using Microsoft.CommandPalette.Extensions;
using Microsoft.CommandPalette.Extensions.Toolkit;
using Microsoft.UI.Xaml;
namespace SamplePagesExtension;
@@ -129,6 +130,25 @@ internal sealed partial class SampleListPageWithDetails : ListPage
],
},
},
new DetailsElement()
{
Key = "Commands",
Data = new DetailsCommands()
{
Commands = [
new ToastCommand("Hey! You clicked it!", MessageState.Success)
{
Name = "Do something amazing",
Icon = new("\uE945"),
},
new ToastCommand("I warned you!", MessageState.Error)
{
Name = "Don't click me",
Icon = new("\uEA39"),
},
],
},
},
],
},
}