Add standalone IconElement for the element tree#271
Conversation
| HyperlinkButton(Command command) → HyperlinkButtonElement | ||
| HyperlinkButton(string content, Uri navigateUri = null, Action onClick = null) → HyperlinkButtonElement | ||
| Icon(IconData data) → IconElement | ||
| Icon(string symbol) → IconElement |
There was a problem hiding this comment.
Do we need one that takes the Symbol enum? It'll be a lot easier to code again instead of a stringified version of it? https://learn.microsoft.com/en-us/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.controls.symbolicon.symbol?view=windows-app-sdk-1.8#microsoft-ui-xaml-controls-symbolicon-symbol
It would then generate the SymbolIcon IconElement
There was a problem hiding this comment.
yeah, i think the enum version is better.
There was a problem hiding this comment.
Good call - added an Icon(Symbol) overload in f18aed9 so you get full IntelliSense on the enum. The string overload is kept for raw glyph strings not in the enum.
| HyperlinkButton(Command command) → HyperlinkButtonElement | ||
| HyperlinkButton(string content, Uri navigateUri = null, Action onClick = null) → HyperlinkButtonElement | ||
| Icon(IconData data) → IconElement | ||
| Icon(string symbol) → IconElement |
There was a problem hiding this comment.
yeah, i think the enum version is better.
|
@codemonkeychris All feedback has been addressed — added the Icon(Symbol) enum overload in f18aed9. Could you re-review when you get a chance? |
Wrap the existing IconData hierarchy (SymbolIconData, FontIconData, BitmapIconData, PathIconData, ImageIconData) in a new IconElement record that can be placed as a child of any layout container. - Element record: IconElement(IconData Data) - Factory methods: Icon(IconData), Icon(string) - Reconciler mount/update handlers - Fluent .Set() extension - Unit tests for record, factories, and with-expressions Closes #257 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adds an overload that takes the WinUI Symbol enum directly for better discoverability and IntelliSense. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
f18aed9 to
8ac6245
Compare
Summary
Adds a new
IconElement(IconData Data)record that wraps the existingIconDatahierarchy so icons can be placed as standalone children in any layout container.Before:
IconDatarecords (SymbolIconData,FontIconData, etc.) could only be used as data slots on composite controls (NavigationViewItemData, MenuFlyoutItemData, etc.). There was no way to render a standalone icon in the element tree.After:
Changes
Element.csIconElement(IconData Data) : ElementrecordDsl.csIcon(IconData)andIcon(string)factory methodsReconciler.Mount.csMountIcon— delegates to existingResolveIconReconciler.Update.csUpdateIcon— patches same-type, replaces on cross-type changeElementExtensions.cs.Set(Action<IconElement>)fluent modifierElementRecordCoverageTests.csTesting
Closes #257