4 Answers, 1 is accepted
0
Accepted
Hello Bala,
Thank you for writing.
To do that you would have to use the formatting events of the control:
More information and examples are available here: http://www.telerik.com/help/winforms/listview-custom-items.html.
I hope this helps.
Regards,
Stefan
Telerik
Thank you for writing.
To do that you would have to use the formatting events of the control:
//Details view
void
radListView1_CellFormatting(
object
sender, ListViewCellFormattingEventArgs e)
{
if
(e.CellElement.Text.Contains(
"4"
))
{
e.CellElement.DrawFill =
true
;
e.CellElement.GradientStyle = GradientStyles.Solid;
e.CellElement.BackColor = Color.Red;
}
else
{
e.CellElement.ResetValue(LightVisualElement.DrawFillProperty, ValueResetFlags.Local);
e.CellElement.ResetValue(LightVisualElement.GradientStyleProperty, ValueResetFlags.Local);
e.CellElement.ResetValue(LightVisualElement.BackColorProperty, ValueResetFlags.Local);
}
}
//Other views
void
radListView1_VisualItemFormatting(
object
sender, ListViewVisualItemEventArgs e)
{
if
(e.VisualItem.Text.Contains(
"4"
))
{
e.VisualItem.DrawFill =
true
;
e.VisualItem.GradientStyle = GradientStyles.Solid;
e.VisualItem.BackColor = Color.Red;
}
else
{
e.VisualItem.ResetValue(LightVisualElement.DrawFillProperty, ValueResetFlags.Local);
e.VisualItem.ResetValue(LightVisualElement.GradientStyleProperty, ValueResetFlags.Local);
e.VisualItem.ResetValue(LightVisualElement.BackColorProperty, ValueResetFlags.Local);
}
}
More information and examples are available here: http://www.telerik.com/help/winforms/listview-custom-items.html.
I hope this helps.
Regards,
Stefan
Telerik
RadChart for WinForms is obsolete. Now what?
0
Bala
Top achievements
Rank 1
answered on 27 Jun 2013, 07:40 PM
Thanks a lot! Works!
0
Vlad
Top achievements
Rank 1
answered on 03 May 2015, 05:43 AM
Private
Sub
lstUsers_VisualItemFormatting(sender
As
Object
, e
As
ListViewVisualItemEventArgs)
Handles
lstUsers.VisualItemFormatting
If
(e.VisualItem.Text.Contains(
"3OFFLINE"
))
Then
e.VisualItem.DrawFill =
True
e.VisualItem.GradientStyle = GradientStyles.Solid
e.VisualItem.BackColor = Color.Red
Else
e.VisualItem.ResetValue(LightVisualElement.DrawFillProperty, ValueResetFlags.Local)
e.VisualItem.ResetValue(LightVisualElement.GradientStyleProperty, ValueResetFlags.Local)
e.VisualItem.ResetValue(LightVisualElement.BackColorProperty, ValueResetFlags.Local)
End
If
End
Sub
0
Vlad
Top achievements
Rank 1
answered on 03 May 2015, 06:53 AM
e.VisualItem.Data("Column 1") = "3OFFLINE" it works.