The RadNavigationView control does not support this behavior out-of-the-box, however, it could still be achieved by writing some custom code.
To do so, create a new class that derives from the RadNavigationView class and overrides the IsItemItsOwnContainerOverride method. If the type of the item parameter is RadNavigationViewItem return the base implementation of this method. Otherwise, return true. This will allow you to set custom elements inside the Items collection of the control, without them being wrapped in a RadNavigationView container.
The following code snippets show this suggestion's implementation:
publicclassCustomNavigationView : RadNavigationView
{
protectedoverrideboolIsItemItsOwnContainerOverride(object item)
{
if (item is RadNavigationViewItem)
{
returnbase.IsItemItsOwnContainerOverride(item);
}
returntrue;
}
}
The following snippet shows the custom RadNavigationView control with two user controls in its Items collection. These user controls hold some elements to show a scenario where the control is populated with not just RadNavigationViewItems:
<local:CustomNavigationViewx:Name="customNavigationView"IsPaneOpen="True"PaneOpened="CustomNavigationView_PaneOpened"PaneClosed="CustomNavigationView_PaneClosed"><telerik:RadNavigationView.Items><!--The OnlineUserControl and OfflineUserControl hold several elements such as TextBlocks and separators--><local:OnlineUserControl/><telerik:RadNavigationViewItemContent="Parameters"/><local:OfflineUserControl/><telerik:RadNavigationViewItemContent="Offline Parameters"/></telerik:RadNavigationView.Items></local:CustomNavigationView>
However, with this approach, the visibility of each element that is not of the RadNavigationViewItem type would have to be manually modified. To do so, the PaneOpened and PaneClosed events could be used to find and update the elements' visibility.
The following snippet shows the above suggestion of showing and hiding the OnlineUserControl and OfflineUserControl:
privatevoidCustomNavigationView_PaneOpened(object sender, RoutedEventArgs e)
{
foreach (var item inthis.customNavigationView.Items)
{
if (item is OnlineUserControl)
{
(item as OnlineUserControl).Visibility = Visibility.Visible;
}
elseif (item is OfflineUserControl)
{
(item as OfflineUserControl).Visibility = Visibility.Visible;
}
}
}
privatevoidCustomNavigationView_PaneClosed(object sender, RoutedEventArgs e)
{
foreach (var item inthis.customNavigationView.Items)
{
if (item is OnlineUserControl)
{
(item as OnlineUserControl).Visibility = Visibility.Collapsed;
}
elseif (item is OfflineUserControl)
{
(item as OfflineUserControl).Visibility = Visibility.Collapsed;
}
}
}
The produced result is as follows:
In addition, I have logged a new feature request about including a way to separate items. The request could be found at the following link: