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

Trouble with TimeSpanPickerComponent

5 Answers 100 Views
TimeSpanPicker
This is a migrated thread and some comments may be shown as answers.
Elon
Top achievements
Rank 1
Elon asked on 23 Aug 2017, 07:57 PM

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

5 Answers, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 28 Aug 2017, 11:06 AM
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   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  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 you to write beautiful native mobile apps using a single shared C# codebase.
0
Elon
Top achievements
Rank 1
answered on 28 Aug 2017, 04:18 PM

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

0
Dinko | Tech Support Engineer
Telerik team
answered on 30 Aug 2017, 11:25 AM
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 you to write beautiful native mobile apps using a single shared C# codebase.
0
Elon
Top achievements
Rank 1
answered on 30 Aug 2017, 05:40 PM

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

0
Dinko | Tech Support Engineer
Telerik team
answered on 04 Sep 2017, 12:21 PM
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 you to write beautiful native mobile apps using a single shared C# codebase.
Tags
TimeSpanPicker
Asked by
Elon
Top achievements
Rank 1
Answers by
Dinko | Tech Support Engineer
Telerik team
Elon
Top achievements
Rank 1
Share this question
or