-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Closed as not planned
Labels
area - sidebarFeatures or bug reports relating to the sidebarFeatures or bug reports relating to the sidebar
Description
Description
The current sidebar implementation has several issues, which is simply because we ported the controls over to custom controls and was fairly a hard work.
- The whole instance of ViewModel is passed to the control
- The control uses
Binding-s in the styles, which is AOT-incompatible - There's a dedicated view model for the user control,
SidebarViewwith 1.3k loc - There's an interface for the view model
- There's an interface for data template of the
SidebarItem - Item clicking event is heavily tied to the view model
- Item changed event is heavily tied to the related services like
QuickAccessService
Here's the proposed version of the sidebar.
- The control implementation design will be similar to that of
NavigationView - The
SidebarViewModelwill be removed - Bindings will be done in
MainPageViewModel - The control will make use of events for dragging and clicking
- The view model will make use of events for data source from e.g.
QuickAccessService - The control will allow to expand folders toward the tree view proposal
Here's the API spec:
- SidebarView2
- prop:
SidebarViewDisplayMode2 DisplayMode - prop:
bool IsPaneOpen - prop:
object MenuItemsSource - prop:
object FooterItemsSource - prop:
double OpenPaneLength - prop:
object SelectedItem
- prop:
- SidebarView2SectionItem
- prop:
object Icon - prop:
object Text - prop:
IList<object> Items
- prop:
- SidebarView2Item
- prop:
bool CanDrag= true - prop:
bool AllowDrop= true - prop:
object Icon - prop:
object Text - prop:
bool IsExpanded - prop:
bool CanExpand - prop:
object Decorator - prop:
IList<object> Items
- prop:
Here's an example of usage:
<controls:SidebarView2
DisplayMode="{x:Bind ViewModel.SidebarView2DisplayMode, Mode=TwoWay}"
IsPaneOpen="{x:Bind ViewModel.SidebarView2IsPaneOpen, Mode=TwoWay}"
MenuItemsSource="{x:Bind ViewModel.SidebarView2SectionItems, Mode=OneWay}"
FooterItemsSource="{x:Bind ViewModel.SidebarView2FooterItems, Mode=OneWay}"
OpenPaneLength="{x:Bind ViewModel.SidebarView2OpenPaneLength, Mode=OneWay}"
SelectedItem="{x:Bind ViewModel.SidebarView2SelectedItem, Mode=TwoWay}"
ItemClicked="SidebarView2_ItemClicked"
RightClicked="SidebarView2_ItemClicked"
ItemReordered="SidebarView2_ItemReordered">
<controls:SidebarView2.EmptyView>
<!-- empty view -->
</controls:SidebarView2.EmptyView>
<controls:SidebarView2.Header>
<!-- inner navigation toolbar -->
</controls:SidebarView2.Header>
<controls:SidebarView2.Content>
<!-- content + info pane + shelf pane -->
</controls:SidebarView2.Content>
<controls:SidebarView2.Footer>
<!-- status bar -->
</controls:SidebarView2.Footer>
</controls:SidebarView2>Concerned code
The whole sidebar-related code
Gains
- Simplicity of the control implementation
- Isolation of the control and the backend (view model)
Requirements
- Implement a whole control, SidebarView2
- No code change in the application until we replace with this
- All work will be done in the playground app
Comments
CC @marcelwgn
Metadata
Metadata
Assignees
Labels
area - sidebarFeatures or bug reports relating to the sidebarFeatures or bug reports relating to the sidebar
Type
Projects
Status
✅ Done