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

RadTimePicker usage is different depending on which version?

6 Answers 136 Views
TimePicker
This is a migrated thread and some comments may be shown as answers.
Kang JungSu
Top achievements
Rank 1
Kang JungSu asked on 22 Oct 2010, 09:43 AM

Hi.

I is not accustomed to writing in English. Therefore, it can be difficult to read the Thread. Please understand.

RadComboBox and RadTimePicker use, the program being developed, I have a problem.
My program, RadComboBox selection index is used to change the value TimeInterval of RadTimePicker.

XMAL code below, I have been using is normally. Assembly version is the 2010.1.603.35

 

<Window x:Class="TimePicker_Test.Window1"
        xmlns:sys="clr-namespace:System;assembly=mscorlib"
        xmlns:telerikStyle="http://schemas.telerik.com/2008/xaml/presentation"
        xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
        xmlns:telerikPanel="clr-namespace:Telerik.Windows.Controls.Primitives;assembly=Telerik.Windows.Controls"
        xmlns:telerikInput="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Input"
        Title="MainWindow" Height="350" Width="525">
  
    <Window.Resources>
        <ResourceDictionary>
  
            <sys:TimeSpan x:Key="timespan_5min">
                0:5:0
            </sys:TimeSpan>
  
            <sys:TimeSpan x:Key="timespan_hour">
                1:0:0
            </sys:TimeSpan>
  
            <Style x:Key="ui_TimePicker" TargetType="{x:Type telerikInput:RadTimePicker}">
                <Style.Triggers>
  
                    <DataTrigger Binding="{Binding ElementName=ui_RadComboBox, Path=SelectedIndex}" Value="0">
                        <Setter Property="TimeInterval" Value="{StaticResource timespan_5min}" />
                    </DataTrigger>
  
                    <DataTrigger Binding="{Binding ElementName=ui_RadComboBox, Path=SelectedIndex}" Value="1">
                        <Setter Property="TimeInterval" Value="{StaticResource timespan_hour}" />
                    </DataTrigger>
  
                </Style.Triggers>
            </Style>
  
  
            <!--RadTimePicker ScrollBar-->
            <LinearGradientBrush x:Key="HeaderBackgroundBrush" EndPoint="0.5,1" StartPoint="0.5,0">
                <GradientStop Color="#FFF8F8F9" Offset="0"/>
                <GradientStop Color="#FFDBDEE1" Offset="1"/>
                <GradientStop Color="#FFDFE2E5" Offset="0.4"/>
                <GradientStop Color="#FFC7CBD1" Offset="0.4"/>
            </LinearGradientBrush>
            <LinearGradientBrush x:Key="BorderOuterColor" EndPoint="0.714,1.292" StartPoint="0.318,0.068">
                <GradientStop Color="#FFdbdcde" Offset="0.39079609253679837" />
                <GradientStop Color="#FFc6c7c8" Offset="1" />
            </LinearGradientBrush>
            <SolidColorBrush x:Key="HeaderForegroundBrush" Color="#FF000000"></SolidColorBrush>
            <SolidColorBrush x:Key="ContentBackgroundBrush" Color="#f0f1f2" />
            <SolidColorBrush x:Key="HeaderBackgroundBrush11" Color="#FFFFFFFF" />
            <Style x:Key="HeaderContentStyle" TargetType="ContentControl">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="ContentControl">
                            <Grid x:Name="RootElement" Margin="0" Background="Transparent">
                                <Rectangle Fill="Transparent" />
                                <ContentPresenter x:Name="buttonContent" HorizontalAlignment="Center"
                                                       Margin="{TemplateBinding Padding}" RenderTransformOrigin="0.5,0.5"
                                                       VerticalAlignment="Center" />
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
  
  
            <Style x:Key="ui_Clock" TargetType="telerikInput:RadClock">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="telerikInput:RadClock">
                            <Border BorderBrush="{TemplateBinding BorderBrush}" 
                                       BorderThickness="{TemplateBinding BorderThickness}" 
                                       Background="{TemplateBinding Background}">
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="30" />
                                        <RowDefinition Height="*" />
                                    </Grid.RowDefinitions>
  
                                    <!--Header background: -->
                                    <Border Background="{StaticResource HeaderBackgroundBrush}" BorderBrush="{StaticResource BorderOuterColor}" BorderThickness="0 0 0 1" >
  
                                        <ContentControl x:Name="button" 
                                                             Content="{TemplateBinding Header}"
                                                             ContentTemplate="{TemplateBinding HeaderTemplate}"
                                                             HorizontalAlignment="Center" Grid.Row="0"
                                                             Foreground="{StaticResource HeaderForegroundBrush}"
                                                             Style="{StaticResource HeaderContentStyle}" />
                                    </Border>
  
                                    <ScrollViewer MaxHeight="200" Grid.Row="1">
                                        <ItemsPresenter x:Name="ItemsPresenter" ></ItemsPresenter>
                                    </ScrollViewer>
  
                                </Grid>
                            </Border>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
                <Setter Property="Header" Value="Clock" />
                <Setter Property="ItemsPanel">
                    <Setter.Value>
                        <ItemsPanelTemplate>
                            <telerikPanel:RadUniformGrid x:Name="uniformGrid" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
                        </ItemsPanelTemplate>
                    </Setter.Value>
                </Setter>
                <Setter Property="ItemTemplate">
                    <Setter.Value>
                        <DataTemplate>
                            <Border x:Name="Borderarea" VerticalAlignment="Center">
                                <TextBlock x:Name="ContentText" TextAlignment="Center"
                                              HorizontalAlignment="Center" VerticalAlignment="Center"
                                              Text="{Binding}" Margin="5 2 5 2" />
                            </Border>
                        </DataTemplate>
                    </Setter.Value>
                </Setter>
                <Setter Property="Background" Value="{StaticResource ContentBackgroundBrush}" />
  
                <Setter Property="Margin" Value="0" />
                <Setter Property="BorderBrush" Value="{StaticResource BorderOuterColor}" />
                <Setter Property="BorderThickness" Value="1" />
                <Setter Property="StartTime" Value="0:0:0" />
                <Setter Property="EndTime" Value="23:59:0" />
                <Setter Property="TimeInterval" Value="1:0:0" />
            </Style>
  
        </ResourceDictionary>
    </Window.Resources>
  
    <Grid>
        <StackPanel>
            <telerikInput:RadComboBox x:Name="ui_RadComboBox"  SelectedIndex="0">
                <telerikInput:RadComboBoxItem Content="5Minute" />
                <telerikInput:RadComboBoxItem Content="Hour" />
            </telerikInput:RadComboBox>
            <telerikInput:RadTimePicker Culture="en-US" Style="{StaticResource ui_TimePicker}" >
            </telerikInput:RadTimePicker>
        </StackPanel>
  
    </Grid>
</Window>

I recently updated to the Assembly version was 2010.2.812.40.
Use this code in the updated version, there is a problem.

First, RadTimePicker Dropdown Item When we do not display properly spaced
This was resolved by specifying ClockSyle. In previous versions, but was not required to specify
<telerikInput:RadTimePicker Culture="en-US" Style="{StaticResource ui_TimePicker}" ClockStyle="{StaticResource ui_Clock}"/>

Second, RadComboBox changes in the selected index when using DataTrigger RadTimePicker tries to change the value of the TimeInterval.

In previous versions of normal, respectively. However, the updated version does not change the value.
Which part is the problem, but I do not know many tests.

To using this code is wrong? Or, there is a problem with the updated version?

I can not find the correct answer, writes Thread.

Wait for an answer. Thanks.

6 Answers, 1 is accepted

Sort by
0
Kaloyan
Telerik team
answered on 26 Oct 2010, 09:05 AM
Hello Kang JungSu,

You just need to remove the following setter  from the RadClock style:
<Setter Property="TimeInterval" Value="1:0:0" />



Best wishes,
Kaloyan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Kang JungSu
Top achievements
Rank 1
answered on 27 Oct 2010, 01:38 AM
Hi.

TimeInterval Setter was a remove from the Clock Style. But the problems remain the same.

Please check back.

Thanks.
0
Kaloyan
Telerik team
answered on 29 Oct 2010, 12:09 PM
Hello Kang JungSu,

What i forgot to tell you is to set a TwoWay binding in the TimeInterval binding expression:
<Style x:Key="ui_TimePicker" TargetType="{x:Type telerikInput:RadTimePicker}">
                <Style.Triggers>
  
                    <DataTrigger
                            Binding="{Binding ElementName=ui_RadComboBox, Path=SelectedIndex, Mode=TwoWay}"
                            Value="0">
                        <Setter Property="TimeInterval" Value="{StaticResource timespan_5min}" />
                    </DataTrigger>
  
                    <DataTrigger
                            Binding="{Binding ElementName=ui_RadComboBox, Path=SelectedIndex, Mode=TwoWay}"
                            Value="1">
                        <Setter Property="TimeInterval" Value="{StaticResource timespan_hour}" />
                    </DataTrigger>
  
                </Style.Triggers>
            </Style>


Sincerely yours,
Kaloyan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Kang JungSu
Top achievements
Rank 1
answered on 07 Feb 2011, 10:08 AM
Hello.

OK now, the last answer

TwoWay binding mode to, but did not solve the problem
0
Accepted
Kaloyan
Telerik team
answered on 09 Feb 2011, 11:00 AM
Hi Kang JungSu,

You can't bind directly to the TimeInterval, due to some internal issues. Check the attached project, representing a work around for your case.

All the best,
Kaloyan
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Kang JungSu
Top achievements
Rank 1
answered on 10 Feb 2011, 07:53 AM
Hello Kaloyan.

Thanks, it worked.
Tags
TimePicker
Asked by
Kang JungSu
Top achievements
Rank 1
Answers by
Kaloyan
Telerik team
Kang JungSu
Top achievements
Rank 1
Share this question
or