How to change the color of the item in a radlistcontrol in winfroms using telerik.
I want to hover the mouse in the listbox and want the hilighted color of the list item to be black instead of deafult white. Please help.
I have posted my current status and my requirement.
4 Answers, 1 is accepted
0
Hello Rohanjoy,
Thank you for writing.
The provided screenshot is greatly appreciated. Here is a sample code snippet demonstrating how to change the hover color for the visual items:
I hope this information helps. Should you have further questions I would be glad to help.
Regards,
Dess
Telerik by Progress
Thank you for writing.
The provided screenshot is greatly appreciated. Here is a sample code snippet demonstrating how to change the hover color for the visual items:
public
RadForm1()
{
InitializeComponent();
this
.radListControl1.VisualItemFormatting += radListControl1_VisualItemFormatting;
}
private
void
radListControl1_VisualItemFormatting(
object
sender, Telerik.WinControls.UI.VisualItemFormattingEventArgs args)
{
args.VisualItem.MouseEnter -= VisualItem_MouseEnter;
args.VisualItem.MouseLeave -= VisualItem_MouseLeave;
args.VisualItem.MouseEnter += VisualItem_MouseEnter;
args.VisualItem.MouseLeave += VisualItem_MouseLeave;
}
private
void
VisualItem_MouseLeave(
object
sender, EventArgs e)
{
RadListVisualItem item = sender
as
RadListVisualItem;
if
(item !=
null
)
{
item.ResetValue(LightVisualElement.GradientStyleProperty, Telerik.WinControls.ValueResetFlags.Local);
item.ResetValue(LightVisualElement.BackColorProperty, Telerik.WinControls.ValueResetFlags.Local);
}
}
private
void
VisualItem_MouseEnter(
object
sender, EventArgs e)
{
RadListVisualItem item = sender
as
RadListVisualItem;
if
(item !=
null
)
{
item.GradientStyle = Telerik.WinControls.GradientStyles.Solid;
item.BackColor = Color.Lime;
}
}
I hope this information helps. Should you have further questions I would be glad to help.
Regards,
Dess
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which
deliver the business app essential building blocks - a grid component,
data visualization (charts) and form elements.
0
Rohanjoy
Top achievements
Rank 1
answered on 21 Apr 2017, 10:07 AM
Thank you so much for for the reply. And yes it worked. But there is only one issue with this. After selected an item if i hover on it once more, it highlight color is sowing white but i need it to be black also.
0
Hello Rohanjoy,
Thank you for writing back.
I am glad that the provided solution was helpful. However, if you run the project you will notice that once you select an item, it gets orange. If you hover the selected node, it will be Color.Lime. Could you please specify the exact steps how to reproduce the problem you are facing? Feel free to modify my sample project in a way to reproduce the experienced undesired style and get back to me with it so I can investigate the precise case. Thank you in advance.
I am looking forward to your reply.
Regards,
Dess
Telerik by Progress
Thank you for writing back.
I am glad that the provided solution was helpful. However, if you run the project you will notice that once you select an item, it gets orange. If you hover the selected node, it will be Color.Lime. Could you please specify the exact steps how to reproduce the problem you are facing? Feel free to modify my sample project in a way to reproduce the experienced undesired style and get back to me with it so I can investigate the precise case. Thank you in advance.
I am looking forward to your reply.
Regards,
Dess
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which
deliver the business app essential building blocks - a grid component,
data visualization (charts) and form elements.
0
Rohanjoy
Top achievements
Rank 1
answered on 21 Apr 2017, 01:34 PM
Thanks dess. It has worked. I just had to change the color.