How to change ForeGround in DataField

3 posts, 0 answers
  1. Max
    Max avatar
    2 posts
    Member since:
    Nov 2012

    Posted 16 Jun 2013 Link to this post

    I have a big trouble. I have spent to this too much time.
    How can i change color of header of DataField? Color dependences to System Theme by default...
    I tried change Foregroud option in DataField.EditorStyle, DataField.Style and others.. Plz help.
  2. Todor
    Admin
    Todor avatar
    778 posts

    Posted 19 Jun 2013 Link to this post

    Hi Max,

    I have answered to your support ticket regarding the same question. I'm copying the answer here in case any one else wants to know how to edit the foreground of the header.

    RadDataForm internally uses different controls for editors and the style that is added to the EditorStyles has to target the specific editor. Then, depending on that control you need to change its foreground, you need to add its respective style. For example, if you need to change the foreground of an editor for a field that is of type string, you need to know that the editor is of type RadTextBox. Here's how you can change the foreground of that header:
    <telerikInput:DataField TargetProperty="Item1">
            <telerikInput:DataField.EditorStyles>
                    <Style TargetType="telerikPrimitives:RadTextBox">
                            <Setter Property="HeaderStyle">
                                    <Setter.Value>
                                            <Style TargetType="ContentControl">
                                                    <Setter Property="Foreground" Value="{StaticResource PhoneSubtleBrush}"/>
                     <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeNormal}"/>
                     <Setter Property="HorizontalAlignment" Value="Left"/>
             </Style>
                     </Setter.Value>
                            </Setter>
                    </Style>
            </telerikInput:DataField.EditorStyles>
    </telerikInput:DataField>

    I have highlighted the foreground of the header that is currently the static resource PhoneSubtleBrush. You just need to change it to the value of your choice.

    Regards,
    Todor
    Telerik
    Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
  3. DevCraft banner
  4. Max
    Max avatar
    2 posts
    Member since:
    Nov 2012

    Posted 19 Jun 2013 Link to this post

    Thank you for amazing support!
Back to Top