Commit 37f4a9c
Redesign as a single result-oriented ResolveFlyoutItemTemplate API
Replaces the three algorithm-piece methods with one nullable-annotated,
result-oriented entry point:
public static DataTemplate? ResolveFlyoutItemTemplate(Shell? shell, BindableObject flyoutItem)
It returns the final application-defined template, or null meaning "use your
own platform-native default". Rationale for the change:
* `Get*` on Shell reads as an attached-property accessor, which these were not.
* Exposing the property/source/is-set trio froze the internal lookup levels as
public contract.
* The documented binding context was wrong. The built-in Android, iOS, and
Windows backends all bind created content to the flyout item itself
(`View.BindingContext = context` / `_content.BindingContext = bo`), not to the
object that carried the template, which for `ShellContent.MenuItems` is the
parent `ShellContent`.
`MenuShellItem` and the paired-object lookup stay internal.
Null handling is explicit: an item that sets the template property wins even
when the value is null (so an app can opt one item out of a Shell level
template), and a null or null-bound value is reported as "no template" rather
than producing a true/null mismatch or an NRE in platform code.
`IShellController.GetFlyoutItemDataTemplate` now composes the new method with
the default flyout cell, so the in-box path never hands null to platform code.
The Windows backend is dogfooded through the public API, and the in-box Tizen
adaptor now resolves and null-checks in one step.
Tests grow to 23 and add binding coverage: Text/Command bound through
`ShellContent.MenuItems` and through Shell-level `MenuItemTemplate`, flyout
selection invoking the command, item vs Shell template precedence, explicit
null, null-bound, `DataTemplateSelector`, headers/footers and their templates,
Shell resolution when the argument is omitted, unparented items, and argument
validation.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>1 parent 7d740bf commit 37f4a9c
12 files changed
Lines changed: 343 additions & 204 deletions
File tree
- src/Controls
- src/Core
- Handlers/Shell
- Tizen
- Windows
- PublicAPI
- net-android
- net-ios
- net-maccatalyst
- net-tizen
- net-windows
- netstandard
- net
- Shell
- tests/Core.UnitTests
Lines changed: 7 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
53 | | - | |
54 | | - | |
| 52 | + | |
55 | 53 | | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
61 | 58 | | |
62 | | - | |
| 59 | + | |
| 60 | + | |
63 | 61 | | |
64 | 62 | | |
65 | 63 | | |
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
70 | 76 | | |
71 | 77 | | |
72 | 78 | | |
| |||
Lines changed: 1 addition & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
319 | 319 | | |
320 | 320 | | |
321 | 321 | | |
322 | | - | |
323 | | - | |
324 | | - | |
| 322 | + | |
Lines changed: 1 addition & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
239 | 239 | | |
240 | 240 | | |
241 | 241 | | |
242 | | - | |
243 | | - | |
244 | | - | |
| 242 | + | |
Lines changed: 1 addition & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
231 | 231 | | |
232 | 232 | | |
233 | 233 | | |
234 | | - | |
235 | | - | |
236 | | - | |
| 234 | + | |
Lines changed: 1 addition & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
226 | | - | |
227 | | - | |
228 | | - | |
| 226 | + | |
Lines changed: 1 addition & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
274 | 274 | | |
275 | 275 | | |
276 | 276 | | |
277 | | - | |
278 | | - | |
279 | | - | |
| 277 | + | |
Lines changed: 1 addition & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
218 | 218 | | |
219 | 219 | | |
220 | 220 | | |
221 | | - | |
222 | | - | |
223 | | - | |
| 221 | + | |
Lines changed: 1 addition & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
212 | | - | |
213 | | - | |
214 | | - | |
| 212 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
615 | 615 | | |
616 | 616 | | |
617 | 617 | | |
618 | | - | |
| 618 | + | |
619 | 619 | | |
620 | 620 | | |
621 | 621 | | |
| |||
0 commit comments