You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Proposal: Update NavigationView to use ItemsRepeater
Summary
Instead of ListView, perhaps NavigationView should use ItemsRepeater as an implementation detail. This shouldn't have any direct impact on users but would help clean up the code.
Rationale
Currently NavigationView has a dependency on ListView in order to display the MenuItems. This becomes a drawback in places where we have to circumvent some of ListView's existing behaviors which results in complicated codepaths and is a way for bugs to be introduced.
Pros to moving to ItemsRepeater:
Greater control over selection behavior which will result in cleaner code. Currently item selection logic is tangled up with the ListView selection logic
Have to keep track of selection state in two different locations. We have to manage and sync selection when it is changed using NavigationView API or when it is changed in the ListView.
Have to deal with callbacks for scenarios where we don’t want selection on invocation
Moving items in and out of a listview also sometimes influences selection
Item-repeater is less policy-heavy. Less restrictions can potentially mean less problems when implementing other future functionality. This is an advantage for Top and Hierarchical Navigation as these features are not based on a single listview and require movement of items. This flexibility also gives us a greater control over functionality such as animations.
Circumvents ListView pre-rs5 bug which manifests in databinding scenarios when adding a container as the root of the datatemplate.
Cons to moving to ItemsRepeater:
Have to re-implement behavior that is handled by listview
Selection
Item Invocation
Container - Item mapping
Markup VS Databinding scenarios
since ItemsRepeater only takes an ItemsSource, we would have to handle the scenarios where either the menuitems are declared in MarkUp or the ItemsSource requires default container wrapping (NavigationViewItem)
AutomationPeer
ItemContainerStyle/ItemContainerStyleSelector
Scenarios where previous app implementations are dependent on ListView functionality (such as SelectorItem.IsSelected) would get broken. Would have to write supporting code for these issues.
Functional Requirements
Important Notes
Open Questions
The text was updated successfully, but these errors were encountered:
Proposal: Update NavigationView to use ItemsRepeater
Summary
Instead of ListView, perhaps NavigationView should use ItemsRepeater as an implementation detail. This shouldn't have any direct impact on users but would help clean up the code.
Rationale
Currently NavigationView has a dependency on ListView in order to display the MenuItems. This becomes a drawback in places where we have to circumvent some of ListView's existing behaviors which results in complicated codepaths and is a way for bugs to be introduced.
Pros to moving to ItemsRepeater:
Cons to moving to ItemsRepeater:
Functional Requirements
Important Notes
Open Questions
The text was updated successfully, but these errors were encountered: