This is a migrated thread and some comments may be shown as answers.

Alter ForeColor for disabled RadListDataItem

6 Answers 157 Views
ListControl
This is a migrated thread and some comments may be shown as answers.
melkorman
Top achievements
Rank 1
melkorman asked on 19 Nov 2010, 09:55 AM
Hi,

I have a ListControl that contains among others some disabled ListDataItems. These list items are grayed out, but I would like them to show a bit more clearly, for example by setting the text color. I am using the Office2010 theme, so if possible I would like to use the same orange-ish color for the text of the disabled items as is used as background color for selected items in the list.

Is this achievable?

Best regards
Linus

6 Answers, 1 is accepted

Sort by
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 19 Nov 2010, 11:05 AM
Hello,

It's not possible to alter the forecolor of a disabled item. You can change the font in this way
For Each item As RadListDataItem In Me.RadListControl1.Items  
    If item.Enabled = False Then
        Dim FontName As String = "Arial"
        Dim FontSize As Integer = 8
        Dim myFont As New Font(FontName, FontSize, FontStyle.Regular)
        item.Font = myFont
    End If
Next

Hope that helps
Richard
0
melkorman
Top achievements
Rank 1
answered on 19 Nov 2010, 11:16 AM
Thank you very much for your answer!

How unfortunate though! Will this be remedied in a future release?

Linus
0
Richard Slade
Top achievements
Rank 2
answered on 19 Nov 2010, 11:23 AM
Hello,

I don't really see this as something which is an issue. It is usual to be able to set forecolor and backcolor and so on of controls that are enabled, but a usual state of a control that is not enabled is to be greyed-out. If you want it to stand out, you could always add an image to that item (it would appear as grey as well, but may make it stand out)

Hope that helps
Richard
0
melkorman
Top achievements
Rank 1
answered on 19 Nov 2010, 11:44 AM
Thanks again for answering!

In general I agree that this is not an issue. A short explanation of my scenario might clarify why I still think that it would be a good feature:

In my case, the list is populated with items depending on what is selected in a tree control. When a child node in the tree is selected, the list will contain items that are related both to the child node and the parent node(s). The items related to the parent node(s) have to be disabled, because they can not be deselected for the child node. The reason why they should be more clearly visualized is because they still influence the state of the child node in the tree.

Hope that helps you understand the rationale behind my request. Maybe this scenario is better accomplished in some other way?
0
Richard Slade
Top achievements
Rank 2
answered on 19 Nov 2010, 11:50 AM
Hi,

without seeing your project it's difficult to say what might be the best way to achieve this. But it sounds like perhaps you should be changing the datasource for the list depending on the TreeNodes that you have selected?

hope this helps
Richard

EDIT // Of course though, the fact that an item is not enabled, is a different color and is not selectable is a usual windows way of highlighting that something cannot be changed.
Best regards,
Richard
0
Accepted
Dobry Zranchev
Telerik team
answered on 24 Nov 2010, 12:57 PM
Hello,

Thank you for writing.

Our theming mechanism allows for setting a specific style to an element when this element is in a disabled state. In regards to the case of Linus, the following steps should be completed:
1. Open your theme in the Visual Style Builder and select RadListControl.
2. Select RadListVisualItem in the tree of the RadListControl.
3. In the Elements window expand RadListVisualItem and remove the property filter.
4. Find the property UseDefaultDisablePaint and set it to false.

These steps will allow for setting the text, fill and border of a RadListVisualItem when it is disabled.

Sincerely yours,
Dobry Zranchev
the Telerik team
Get started with RadControls for WinForms with numerous videos and detailed documentation.
Tags
ListControl
Asked by
melkorman
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
melkorman
Top achievements
Rank 1
Dobry Zranchev
Telerik team
Share this question
or