Trouble with TimeSpanPickerComponent

6 posts, 0 answers
  1. Elon
    Elon avatar
    7 posts
    Member since:
    Apr 2016

    Posted 23 Aug Link to this post

    How can I change the foreground color of the TimeSpanPickerComponent?

    I've tried customizing my own RadTimeSpanPicker but unable to go pass the ItemsControl in the XAML (which contains a list of RadTimeSpanPickerComponents, e.g. hour/min/sec/etc picker, but not exposed via copied template. 

    -----------------------------------------

                            <telerik:RadDropDownButton x:Name="PART_DropDownButton"

    . . .
                                >
                                <telerik:RadDropDownButton.DropDownContent>
                                     . . .
                                        <ItemsControl
                                            ItemContainerStyle="{TemplateBinding TimeSpanComponentStyle}"
                                            Foreground="Red"
                                            Padding="3,0" Focusable="False" 
                                            >
                                            <ItemsControl.ItemsPanel>
                                                <ItemsPanelTemplate>
                                                    <DockPanel Background="Transparent" IsItemsHost="True"/>
                                                </ItemsPanelTemplate>
                                            </ItemsControl.ItemsPanel>
                                        </ItemsControl>
                                       

    ---------------------------------------

    I've also tried to set the Foreground via TimeSpanComponentStyle

    TimeSpanComponentStyle="{DynamicResource TimeSpanComponentStyle1}"

     

    I'd appreciate some assistance. Thanks.

    -Elon

  2. Dinko
    Admin
    Dinko avatar
    412 posts

    Posted 28 Aug Link to this post

    Hi Elon,

    Thank you for your interest in RadTimeSpanPicker control.

    To change TimeSpanPickerComponents you can create a custom implicit style with a TargetType set to telerik:RadTimeSpanPickerComponent  and set the Foreground property.
    <Style TargetType="telerik:RadTimeSpanPickerComponent">
        <Setter Property="Foreground" Value="Red"/>
    </Style>

    If you don't want to be an implicit style you can set x:Key to the style and set it to the TimeSpanComponentStyle property of the RadTimeSpanPicker control.

    Give this approach a try and let me know if it works for you.

    Regards,
    Dinko
    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.
  3. Elon
    Elon avatar
    7 posts
    Member since:
    Apr 2016

    Posted 28 Aug in reply to Dinko Link to this post

    Hi Dinko,

    Thanks for the response. As I've mentioned, I had tried setting the foreground via TimeSpanComponentStyle explicitly (x:Key) and it didn't work. I've just tried without the explicit key (default) and it also didn't work.

    -Elon

  4. Dinko
    Admin
    Dinko avatar
    412 posts

    Posted 30 Aug Link to this post

    Hello Elon,

    I am not sure what could be the reason behind this behavior. Attached to this reply you can find the project which I used to test your scenario. I can you take a look at this project and let me know if I am missing something from your implementation. 

    When you run the project press the drop down button. You can see that the TimeSpanPicker component header foreground is red. You can modify the project to reproduce this behavior and send it back to me.

    Regards,
    Dinko
    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.
  5. Elon
    Elon avatar
    7 posts
    Member since:
    Apr 2016

    Posted 30 Aug in reply to Dinko Link to this post

    Hi Dinko,

    The foreground for the rest of the contents of the drop down popup is still black. 

    Anyways, I've moved on and created my own control.

    Thanks for your assistance.

    -Elon

  6. Dinko
    Admin
    Dinko avatar
    412 posts

    Posted 04 Sep Link to this post

    Hi Elon,

    I haven't understood that you want to change the color of the RadListBox controls inside the drop down content. To change the foreground color of the list box controls you can extract the default template of the RadTimeSpanPickerComponent and modify it. You can take a look at the Editing Control Templates help article which describes how you can extract the template. In the extracted template you can navigate to the RadListBox and set its Foreground property to Red (for example).

    I have modified the project from my previous reply to demonstrate this project.

    Regards,
    Dinko
    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