@@ -33,15 +33,21 @@ Without a Level, the ContentTemplate will be applied to all items that have no c
33
33
var item = context as PanelBarItem;
34
34
35
35
<div style="padding: 8px 16px;">
36
- <span style="text-decoration: underline; color: blue;">
37
- content template for: @item.Text
38
- </span>
39
- <br />
40
- @if (item.Text == "Item 2")
36
+ @if (item.Text == "New Web Site")
41
37
{
38
+ <strong style="text-decoration: underline; color: green;">
39
+ content template for: @item.Text
40
+ </strong>
41
+ <br />
42
42
<TelerikButton ThemeColor="primary">Nested Component</TelerikButton>
43
43
}
44
-
44
+ else
45
+ {
46
+ <span style="text-decoration: solid; color: blue;">
47
+ content template for: @item.Text
48
+ </span>
49
+ <br />
50
+ }
45
51
</div>
46
52
}
47
53
</ContentTemplate>
@@ -51,12 +57,13 @@ Without a Level, the ContentTemplate will be applied to all items that have no c
51
57
</div>
52
58
53
59
@code {
54
- public List<PanelBarItem> Items { get; set; }
60
+ private List<PanelBarItem> Items { get; set; }
55
61
56
62
public class PanelBarItem
57
63
{
58
64
public string Text { get; set; }
59
65
public List<PanelBarItem> Items { get; set; }
66
+ public ISvgIcon Icon { get; set; }
60
67
}
61
68
62
69
protected override void OnInitialized()
@@ -65,29 +72,34 @@ Without a Level, the ContentTemplate will be applied to all items that have no c
65
72
{
66
73
new PanelBarItem()
67
74
{
68
- Text = "Item 1",
75
+ Text = "My Documents",
76
+ Icon = SvgIcon.FolderMore,
69
77
Items = new List<PanelBarItem>()
70
78
{
71
79
new PanelBarItem()
72
80
{
73
- Text = "Item 1.1"
81
+ Text = "Reports",
82
+ Icon = SvgIcon.Folder,
74
83
},
75
- new PanelBarItem()
84
+ new PanelBarItem
76
85
{
77
- Text = "Item 1.2",
86
+ Text = "Projects",
87
+ Icon = SvgIcon.Folder,
78
88
Items = new List<PanelBarItem>()
79
89
{
80
90
new PanelBarItem()
81
91
{
82
- Text = "Item 1.2.1"
92
+ Text = "November",
93
+ Icon = SvgIcon.Folder
83
94
}
84
95
}
85
96
}
86
97
}
87
98
},
88
99
new PanelBarItem()
89
100
{
90
- Text = "Item 2"
101
+ Text = "New Web Site",
102
+ Icon = SvgIcon.FolderMore
91
103
}
92
104
};
93
105
@@ -96,10 +108,6 @@ Without a Level, the ContentTemplate will be applied to all items that have no c
96
108
}
97
109
````
98
110
99
- > caption The result from the code snippet above
100
-
101
- ![ ContentTemplate example] ( images/content-template-example.png )
102
-
103
111
## See Also
104
112
105
113
* [ Data Binding a PanelBar] ({%slug panelbar-data-binding-overview%})
0 commit comments