1+ @page
2+ @model AvatarUGSample .Pages .IntegrateIntoListViewModel
3+ @{
4+ var template = " <div class='listWrapper'>" +
5+ " ${if(avatar!=='')}" +
6+ " <span class='e-avatar e-avatar-small e-avatar-circle'>${avatar}</span>" +
7+ " ${else}" +
8+ " <span class='${pic} e-avatar e-avatar-small e-avatar-circle'> </span>" +
9+ " ${/if}" +
10+ " <span class='text'>" +
11+ " ${text} </span> </div>" ;
12+
13+ List <object > data = new List <object >();
14+ data .Add (new { text = " Robert" , id = " s_01" , avatar = " " , pic = " pic04" });
15+ data .Add (new { text = " Nancy" , id = " s_02" , avatar = " N" , pic = " " });
16+ data .Add (new { text = " John" , id = " s_03" , pic = " pic01" , avatar = " " });
17+ data .Add (new { text = " Andrew" , id = " s_04" , avatar = " A" , pic = " " });
18+ data .Add (new { text = " Michael" , id = " s_05" , pic = " pic02" , avatar = " " });
19+ data .Add (new { text = " Steven" , id = " s_06" , pic = " pic03" , avatar = " " });
20+ data .Add (new { text = " Margaret" , id = " s_07" , avatar = " M" , pic = " " });
21+ }
22+
23+ <div class =" col-lg-12 control-section" >
24+ <ejs-listview id =' letterAvatarList' dataSource =@data headerTitle =' Contacts' template =" @template" showHeader =true sortOrder =" Ascending" >
25+ </ejs-listview >
26+ </div >
27+
28+
29+ <style >
30+ .control-section {
31+ overflow : auto ;
32+ }
33+
34+ /* Listview Customization */
35+
36+ #letterAvatarList {
37+ max-width : 350px ;
38+ margin : auto ;
39+ border : 1px solid #dddddd ;
40+ border-radius : 3px ;
41+ }
42+
43+ #letterAvatarList .listWrapper {
44+ width : inherit ;
45+ height : inherit ;
46+ position : relative ;
47+ }
48+
49+ #letterAvatarList .e-list-header {
50+ height : 54px ;
51+ }
52+
53+ .material #letterAvatarList .e-list-header .e-text {
54+ line-height : 22px ;
55+ }
56+
57+ .fabric #letterAvatarList .e-list-header .e-text {
58+ line-height : 22px ;
59+ }
60+
61+ .bootstrap #letterAvatarList .e-list-header .e-text {
62+ line-height : 13px ;
63+ }
64+
65+ .highcontrast #letterAvatarList .e-list-header .e-text {
66+ line-height : 20px ;
67+ }
68+
69+ #letterAvatarList .e-list-item {
70+ cursor : pointer ;
71+ height : 50px ;
72+ line-height : 44px ;
73+ border : 0 ;
74+ }
75+
76+ /* Badge Positioning */
77+
78+ #letterAvatarList .e-badge {
79+ margin-top : 12px ;
80+ }
81+
82+ #letterAvatarList .listWrapper .text {
83+ width : 60% ;
84+ display : inline-block ;
85+ vertical-align : middle ;
86+ margin : 0 50px ;
87+ }
88+
89+ /* Avatar Positioning */
90+
91+ #letterAvatarList .listWrapper .e-avatar {
92+ position : absolute ;
93+ top : calc (100% - 40px );
94+ font-size : 10px ;
95+ left : 5px ;
96+ }
97+
98+ /* Avatar Background Customization */
99+
100+ #letterAvatarList .e-list-item :nth-child (1 ) .e-avatar {
101+ background-color : #039BE5 ;
102+ }
103+
104+ #letterAvatarList .e-list-item :nth-child (3 ) .e-avatar {
105+ background-color : #E91E63 ;
106+ }
107+
108+ #letterAvatarList .e-list-item :nth-child (5 ) .e-avatar {
109+ background-color : #009688 ;
110+ }
111+
112+ /* Avatar images using 'background-image' property */
113+
114+ .pic01 {
115+ background-image : url (@Url.Content( " ~/css/avatar/images/pic01.png" ));
116+ }
117+
118+ .pic02 {
119+ background-image : url (@Url.Content( " ~/css/avatar/images/pic02.png" ));
120+ }
121+
122+ .pic03 {
123+ background-image : url (@Url.Content( " ~/css/avatar/images/pic03.png" ));
124+ }
125+
126+ .pic04 {
127+ background-image : url (@Url.Content( " ~/css/avatar/images/pic04.png" ));
128+ }
129+ </style >
0 commit comments