Hi,
I'm trying to add a Separator to a TelerikDrawer but it doesn't work as is expected: no separator is added. Instead, an common item is shown that when clicked, an exception is thrown.
I'm using the default DrawerItem class definition. Here is my code:
public
class
DrawerItem
{
public
string
Text {
get
;
set
; }
public
string
Url {
get
;
set
; }
public
string
Icon {
get
;
set
; }
public
bool
IsSeparator {
get
;
set
; }
}
/* Items */
public
List<DrawerItem> NavigablePages {
get
;
set
; } =
new
List<DrawerItem>
{
new
DrawerItem { Text =
"System Overview"
, Url = Constants.Navigation.HOME, Icon =
"toggle-full-screen-mode"
},
new
DrawerItem { IsSeparator =
true
, Url =
string
.Empty },
// --> don't work
new
DrawerItem { Text =
"Add Container"
, Url = Constants.Navigation.CONTAINERFORM, Icon =
"plus-outline"
},
new
DrawerItem { Text =
"Show App Logs"
, Url = Constants.Navigation.LOGMONITOR, Icon =
"paste-plain-text"
},
new
DrawerItem { Text =
"Options"
, Url = Constants.Navigation.OPTIONS, Icon =
"gear"
}
};
/* Drawer component definition */
<TelerikDrawer Data=
"@NavigablePages"
@bind-Expanded=
"@DrawerExpanded"
MiniMode=
"true"
Mode=
"@DrawerMode.Push"
@
ref
=
"@DrawerRef"
@bind-SelectedItem=
"@SelectedItem"
Width=
"auto"
>
<Template>
<div
class
=
"k-drawer-items"
>
<ul>
@
foreach
(var item
in
NavigablePages)
{
@* stop the propagation of the onclick
event
to prevent the drawer from collapsing *@
@* Use onclick to handle manual item selection and toggle the selected
class
*@
<li @onclick:stopPropagation
@onclick=
"@(() => SelectAndNavigate(item))"
class
=
"k-drawer-item @GetSelectedItemClass(item)"
style=
"white-space:nowrap"
>
<span
class
=
"k-icon k-i-@item.Icon"
style=
"margin-right: 8px;"
></span>
@
if
(DrawerExpanded)
{
<span
class
=
"k-item-text"
>@item.Text</span>
}
</li>
}
</ul>
</div>
</Template>
<Content>
@Body
</Content>
</TelerikDrawer>
Any suggestion on what's going on?
Thanks.
Twain.