Class NavigationViewBuilder
- Namespace
- SharpConsoleUI.Builders
- Assembly
- SharpConsoleUI.dll
Fluent builder for NavigationView controls.
public sealed class NavigationViewBuilder : IControlBuilder<NavigationView>
- Inheritance
-
NavigationViewBuilder
- Implements
- Inherited Members
- Extension Methods
Methods
AddHeader(string, Color, Action<NavigationHeaderBuilder>)
Adds a header with the specified color and child items.
public NavigationViewBuilder AddHeader(string text, Color color, Action<NavigationHeaderBuilder> configure)
Parameters
textstringcolorColorconfigureAction<NavigationHeaderBuilder>
Returns
AddHeader(string, Action<NavigationHeaderBuilder>)
Adds a header with child items configured via the nested builder.
public NavigationViewBuilder AddHeader(string text, Action<NavigationHeaderBuilder> configure)
Parameters
textstringconfigureAction<NavigationHeaderBuilder>
Returns
AddItem(NavigationItem, Action<ScrollablePanelControl>?)
Adds a navigation item with optional content factory.
public NavigationViewBuilder AddItem(NavigationItem item, Action<ScrollablePanelControl>? content = null)
Parameters
itemNavigationItemcontentAction<ScrollablePanelControl>
Returns
AddItem(string, string?, string?, Action<ScrollablePanelControl>?)
Adds a navigation item with optional content factory.
public NavigationViewBuilder AddItem(string text, string? icon = null, string? subtitle = null, Action<ScrollablePanelControl>? content = null)
Parameters
textstringiconstringsubtitlestringcontentAction<ScrollablePanelControl>
Returns
Build()
Builds the NavigationView control.
public NavigationView Build()
Returns
Fill()
Makes the control fill the available vertical space.
public NavigationViewBuilder Fill()
Returns
OnSelectedItemChanged(EventHandler<NavigationItemChangedEventArgs>)
Attaches a handler for the SelectedItemChanged event.
public NavigationViewBuilder OnSelectedItemChanged(EventHandler<NavigationItemChangedEventArgs> handler)
Parameters
Returns
OnSelectedItemChanging(EventHandler<NavigationItemChangingEventArgs>)
Attaches a handler for the SelectedItemChanging event.
public NavigationViewBuilder OnSelectedItemChanging(EventHandler<NavigationItemChangingEventArgs> handler)
Parameters
Returns
Visible(bool)
Sets the visibility.
public NavigationViewBuilder Visible(bool visible = true)
Parameters
visiblebool
Returns
WithAlignment(HorizontalAlignment)
Sets the horizontal alignment.
public NavigationViewBuilder WithAlignment(HorizontalAlignment alignment)
Parameters
alignmentHorizontalAlignment
Returns
WithAnimateTransitions(bool)
Sets whether width transitions are animated.
public NavigationViewBuilder WithAnimateTransitions(bool animate)
Parameters
animatebool
Returns
WithCompactPaneWidth(int)
Sets the width of the navigation pane in Compact display mode.
public NavigationViewBuilder WithCompactPaneWidth(int width)
Parameters
widthint
Returns
WithCompactThreshold(int)
Sets the width threshold at or above which Auto mode resolves to Compact.
public NavigationViewBuilder WithCompactThreshold(int threshold)
Parameters
thresholdint
Returns
WithContentBackground(Color)
Sets the content panel background color.
public NavigationViewBuilder WithContentBackground(Color color)
Parameters
colorColor
Returns
WithContentBorder(BorderStyle)
Sets the content panel border style.
public NavigationViewBuilder WithContentBorder(BorderStyle style)
Parameters
styleBorderStyle
Returns
WithContentBorderColor(Color)
Sets the content panel border color.
public NavigationViewBuilder WithContentBorderColor(Color color)
Parameters
colorColor
Returns
WithContentHeader(bool)
Sets whether to show the content header.
public NavigationViewBuilder WithContentHeader(bool show)
Parameters
showbool
Returns
WithContentPadding(int, int, int, int)
Sets the content panel padding.
public NavigationViewBuilder WithContentPadding(int left, int top, int right, int bottom)
Parameters
Returns
WithContentToolbar(Action<ToolbarControl>)
Configures the content toolbar in the header area.
public NavigationViewBuilder WithContentToolbar(Action<ToolbarControl> configure)
Parameters
configureAction<ToolbarControl>
Returns
WithExpandedThreshold(int)
Sets the width threshold at or above which Auto mode resolves to Expanded.
public NavigationViewBuilder WithExpandedThreshold(int threshold)
Parameters
thresholdint
Returns
WithMargin(Margin)
Sets the margin.
public NavigationViewBuilder WithMargin(Margin margin)
Parameters
marginMargin
Returns
WithMargin(int, int, int, int)
Sets the margin.
public NavigationViewBuilder WithMargin(int left, int top, int right, int bottom)
Parameters
Returns
WithName(string)
Sets the control name.
public NavigationViewBuilder WithName(string name)
Parameters
namestring
Returns
WithNavWidth(int)
Sets the width of the navigation pane.
public NavigationViewBuilder WithNavWidth(int width)
Parameters
widthint
Returns
WithPaneDisplayMode(NavigationViewDisplayMode)
Sets the pane display mode.
public NavigationViewBuilder WithPaneDisplayMode(NavigationViewDisplayMode mode)
Parameters
Returns
WithPaneHeader(string)
Sets the pane header markup text.
public NavigationViewBuilder WithPaneHeader(string markup)
Parameters
markupstring
Returns
WithSelectedColors(Color, Color)
Sets the colors for the selected navigation item.
public NavigationViewBuilder WithSelectedColors(Color foreground, Color background)
Parameters
Returns
WithSelectedIndex(int)
Sets the initially selected item index.
public NavigationViewBuilder WithSelectedIndex(int index)
Parameters
indexint
Returns
WithSelectionIndicator(char)
Sets the selection indicator character.
public NavigationViewBuilder WithSelectionIndicator(char indicator)
Parameters
indicatorchar
Returns
WithStickyPosition(StickyPosition)
Sets the sticky position.
public NavigationViewBuilder WithStickyPosition(StickyPosition position)
Parameters
positionStickyPosition
Returns
WithTag(object)
Sets a tag object.
public NavigationViewBuilder WithTag(object tag)
Parameters
tagobject
Returns
WithVerticalAlignment(VerticalAlignment)
Sets the vertical alignment.
public NavigationViewBuilder WithVerticalAlignment(VerticalAlignment alignment)
Parameters
alignmentVerticalAlignment
Returns
WithWidth(int)
Sets the width.
public NavigationViewBuilder WithWidth(int width)
Parameters
widthint
Returns
Operators
implicit operator NavigationView(NavigationViewBuilder)
Implicit conversion to NavigationView.
public static implicit operator NavigationView(NavigationViewBuilder builder)
Parameters
builderNavigationViewBuilder