DescriptionTextListDataItem item = new DescriptionTextListDataItem();
item.Text = "This is string test";
radDropDownListAdapter.Items.Add(item);
string str1 =
"Name:: " + "test 1" + Environment.NewLine +
"Age:: " + "test 2" + Environment.NewLine +
"ID: : " + "test 3" + Environment.NewLine +
"Scor: " + "test 4" + Environment.NewLine;
item.DescriptionText = str1;
radDropDownListAdapter.SelectedIndex = 0;
Currently i am using VisualStudio2012Light theme and you can see the result in my attach file.
As you can see all my object propertiesrarely seen because it's black and background is blue so my question is how to change this color from black ?
9 Answers, 1 is accepted
Thank you for writing.
I managed to reproduce the described case and I can confirm it is an issue. I have logged it in our feedback portal. You can add your vote and subscribe for status updates here: http://feedback.telerik.com/Project/154/Feedback/Details/147335-fix-raddropdownlist-the-description-text-is-not-clearly-visible-for-the-select.
Your Telerik Points have been updated for this report.
To change the color, you can use the VisualItemFormatting event as show below:
void
radDropDownList1_VisualListItemFormatting(
object
sender, VisualItemFormattingEventArgs args)
{
if
(args.VisualItem.Selected && radDropDownList1.ThemeName ==
"VisualStudio2012Dark"
)
{
args.VisualItem.BackColor = Color.DarkBlue;
}
else
{
args.VisualItem.ResetValue(LightVisualElement.BackColorProperty, ValueResetFlags.Local);
}
}
I hope that you find this information useful. Should you have any other questions, do not hesitate to contact us.
Regards,
Stefan
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
Currently there is no change and the color is still the same.
void
radDropDownList1_VisualListItemFormatting(
object
sender, VisualItemFormattingEventArgs args)
{
if
(args.VisualItem.Selected && radDropDownList1.ThemeName ==
"VisualStudio2012Dark"
)
{
args.VisualItem.DrawFill =
true
;
args.VisualItem.BackColor = Color.DarkBlue;
args.VisualItem.GradientStyle = GradientStyles.Solid;
}
else
{
args.VisualItem.ResetValue(LightVisualElement.DrawFillProperty, ValueResetFlags.Local);
args.VisualItem.ResetValue(LightVisualElement.BackColorProperty, ValueResetFlags.Local);
args.VisualItem.ResetValue(LightVisualElement.GradientStyleProperty, ValueResetFlags.Local);
}
}
Just to make sure we are allowed to set the BackColor, we will set the DrawFill too.
If this does not help, please get back to me with a sample app, where the undesired behavior can be reproduced and I will gladly look into it.
Regards,
Stefan
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
To do that, again in the formatting event, you should look for the DescriptionTextListVisualItem, and change the desired colors. You can even put different colors for the main text and the description text:
void
radDropDownList1_VisualListItemFormatting(
object
sender, VisualItemFormattingEventArgs args)
{
DescriptionTextListVisualItem descriptionItem = args.VisualItem
as
DescriptionTextListVisualItem;
if
(descriptionItem !=
null
)
{
descriptionItem.ForeColor = Color.Blue;
descriptionItem.DescriptionContent.ForeColor = Color.Red;
}
}
I hope that you find this information useful.
Regards,
Stefan
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
This is exactly what i am looking for.
Hello!
Sorry to revive this old thread, but what I'm trying to do starts exactly from here...
How can I set a different color in DescriptionTextListVisualItem based on the value contained in the item?
I can't find how to reach the DescriptionTextListDataItem from the corresponding DescriptionTextListVisualItem.
Thanks!
Thank you for writing.
You can access the data item through the DataItem property of the visual item. Assuming you are having the colors stored in its Tag property, you can handle the VisualListItemFormatting event this way:
private
void
RadDropDownList1_VisualListItemFormatting(
object
sender, VisualItemFormattingEventArgs args)
{
DescriptionTextListDataItem data = args.VisualItem.Data
as
DescriptionTextListDataItem;
if
(data !=
null
)
{
args.VisualItem.BackColor = (Color)data.Tag;
}
}
I hope this helps. Let me know if you have other questions.
Regards,
Hristo
Progress Telerik
That'is it!
Thank you Hristo!