Label styling in code-behind

2 posts, 0 answers
  1. FirstName
    FirstName avatar
    1 posts
    Member since:
    Sep 2017

    Posted 27 Sep Link to this post

    Hi, is there any way I can style label for DataFormDataField inside code-behind file or XAML ? For example, I have such layout and need to change label's foreground color:

    <telerik:DataFormDataField x:Name="someNameHere" VerticalAlignment="Top" Grid.Row="2" Grid.Column="1" Label="{Binding Source={x:Static p:Resources.someValue}, Mode=OneTime, StringFormat='{}{0} :'}">                     

        <telerik:RadDateTimePicker x:Name="datePicker" SelectedDate="{Binding ControlDefinition.selectedDate, StringFormat='{}{0:T} {0:d}', Mode=TwoWay}"/>               </telerik:DataFormDataField>

     

    Thanks in advance.

  2. Vladimir Stoyanov
    Admin
    Vladimir Stoyanov avatar
    23 posts

    Posted 29 Sep Link to this post

    Hello,

    You can set the foreground color of the label like this:  

    <telerik:DataFormDataField x:Name="someNameHere" VerticalAlignment="Top" Grid.Row="2" Grid.Column="1" >
            <telerik:DataFormDataField.Label>
                <telerik:Label Foreground="Red" Content="{Binding Source={x:Static p:Resources.someValue}, Mode=OneTime, StringFormat='{}{0} :'}">
                </telerik:Label>
            </telerik:DataFormDataField.Label>
            <telerik:RadDateTimePicker x:Name="datePicker" SelectedDate="{Binding ControlDefinition.selectedDate, StringFormat='{}{0:T} {0:d}', Mode=TwoWay}"/>
    </telerik:DataFormDataField>

    I hope you find this helpful. Let me know if I can be of any further assistance.

    Regards,
    Vladimir Stoyanov
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Back to Top