View Layout Customization
- 3 minutes to read
This topic provides you with information about different approaches of view layout customization available within the DXNavBar control.
#Orienation of Groups and Items
Within a View, groups can be arranged one after another, either vertically or horizontally. By default, vertical orientation is used. The group arrangement is controlled by the NavBarViewBase.Orientation property.
Orientation = Vertical | Orientation = Horizontal |
---|---|
![]() |
![]() |
Within groups, items are arranged as child elements of specific container panels. The manner in which items are stacked within these panels can be controlled via the NavBarViewBase.ItemsPanelOrientation property. By default, items are oriented vertically.
Items |
Items |
---|---|
![]() |
![]() |
Note that you can define which panel type (a Panel descendant) should contain items within groups by creating a template of the NavBarViewBase.ItemsPanelTemplate type. Depending upon the panel type used, the layout of items can be additionally controlled at the panel level via panel's properties.
#Display Mode of View Content Elements
DXNavBar allows its content elements (such as group headers or items) to be represented for display purposes, using their captions or associated images, or both. Use the NavBarViewBase.DisplayMode attached property to control by which characteristics different view content elements should be represented. The following options are available via this property: DisplayMode.ImageAndText, DisplayMode.Image and DisplayMode.Text.
Note that being an attached property, the NavBarViewBase.DisplayMode can be applied to different child elements of DXNavBar. Within DXNavBar, you can apply this property to view, group and item objects by using specific style properties, such as those listed below.
- View Level: NavBarViewBase.GroupVisualStyle, NavBarViewBase.ItemVisualStyle
- Group Level: NavBarGroup.VisualStyle, NavBarGroup.ItemVisualStyle
- Item Level: NavBarItem.VisualStyle
The following markup demonstrates how a common display mode (ImageAndText) can be applied to a View object to affect all groups and items.
<UserControl.Resources>
<!-- A common display mode for all groups and items -->
<Style x:Key="commonDisplayMode" TargetType="ButtonBase">
<Setter Property="dxn:NavBarViewBase.DisplayMode" Value="Text"/>
</Style>
</UserControl.Resources>
<dxn:NavBarControl x:Name="NavBar" >
<dxn:NavBarControl.View>
<dxn:ExplorerBarView GroupVisualStyle="{StaticResource commonDisplayMode}" ItemVisualStyle="{StaticResource commonDisplayMode}"/>
</dxn:NavBarControl.View>
...
</dxn:NavBarControl>
#Image and Text Layout Settings
The layout of images and texts displayed within group headers and items can be customized by using the NavBarViewBase.ImageSettings and NavBarViewBase.LayoutSettings attached properties. The NavBarViewBase.ImageSettings property allows the image size and stretch behavior to be defined. The NavBarViewBase.LayoutSettings can be used to specify image and text alignments (vertical, horizontal) and image docking behavior. Using combinations of these property settings, you can manipulate the layout of the DXNavbar control as your application requirements dictate.
Custom Layout Variants | Implementation |
---|---|
Custom Layout 1 |
|
Custom Layout 2 |
|
Note that you can enhance these available layout customization scenarios by implementing styling and templating of view elements.