TimePicker defaults to AM

13 posts, 0 answers
  1. Steven
    Steven avatar
    26 posts
    Member since:
    Jan 2008

    Posted 21 Jun 2010 Link to this post

    Hello,

    Whenever we choose a PM time, when we exit the control it defaults back to AM. So 2pm becomes 2AM. We cannot find an event that is triggering this, for example it happens before the LostFocus event fires.

    Many thanks

    Steven
  2. George
    Admin
    George avatar
    1332 posts

    Posted 23 Jun 2010 Link to this post

    Hello Steven,

    Thank you for contacting us.

    I am afraid we don't support such feature. By default when you input 2, for example, the RadTimePicker gets this as 2:00 , not 14:00. You can add a specific Culture to define time format. 
    You can also handle SelectedTimeChanged event and to implement your own custom logic that suits your needs.

    I hope this information helps. I will be glad to assist you further.

    Best wishes,
    George
    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
  3. DevCraft banner
  4. Jingmeng
    Jingmeng avatar
    18 posts
    Member since:
    Jun 2010

    Posted 12 Jul 2010 Link to this post

    hey George,
    what is happen is the time picker is working fine in my computer but not steven's, when we pick up 1400 (2pm) in time picker, it will auto jump to 0200 (2am) after a short period such as half second, i spend several hours to trace the problem, but i get nothing, hope you can help me find out why is that happen.
    btw, we under same working environment, same version of telerik control, vs 2008, silverlight and same version of project.....

    best regard
    MENG
  5. George
    Admin
    George avatar
    1332 posts

    Posted 13 Jul 2010 Link to this post

    Hi Jingmeng,

    Thank you for getting back to us.

    Please, check your regional and time setting for the OS. Also, you could try to set culture for time format. If this could not help you, please send us a sample project that reproduces the issue you have with RadTimePicker.

    I hope this helps. I will be glad to assist you further.
     

    Sincerely yours,
    George
    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
  6. Steven
    Steven avatar
    26 posts
    Member since:
    Jan 2008

    Posted 14 Jul 2010 Link to this post

    Hi George.

    We have discovered that the dateTime Picker fails when we use the New Zealand regional settings. This causes the time to set to AM. This is a problem on XP and Win Server 2003 but not a problem a Mac (finally a reason to have a Mac).

    Please review the attached screen shot showing the format differences between New Zealand and US setting. Please note that we cannot ask our users to change their settings just to accommadate our application.

    Please let me know the outcome. Not sure if you want to change your code for a tinpot island on the other side of the world.

    Regards

    Steven
  7. George
    Admin
    George avatar
    1332 posts

    Posted 16 Jul 2010 Link to this post

    Hi Steven,

    Thank you for contacting us.

    Attached you can find a sample running project with set Culture to English (New Zealand) and it should work fine. Please, test it and let me know if this helps you. If not, please try our latest controls from the Q2 release.
    You can try also our new RadDateTimePicker control that can be used as DatePicker, TimePicker or both. 

    Please, let me know if this helps you. I will be glad to assist you further.
     

    Regards,
    George
    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
  8. LLG
    LLG avatar
    5 posts
    Member since:
    Apr 2010

    Posted 03 Aug 2010 Link to this post

    We were also trying out the RadDateTimePicker control (both using en-US).  We tried putting it in 2 columns of RadGridView (in its CellEditTemplate), using it as a start and end date/time selections.  We added a SelectionChanged and ParseDateTimeValue events for both controls, changing the value of end date/time (2nd control) when it's less than the value of the start date/time (1st control). The control is working perfectly except when selecting a PM time value for the 2nd control.
    1. Original time for control1  is 9:00 AM (same time for control2). 
    2. Select new time (1:00 PM) for control1, control2 displays 1:00 PM too.
    3. Go to control2 to try to select another time. Upon clicking on control2, its time changes from 1:00 PM to 1:00 AM.
        Notes: 
        a. First, it triggers control2's ParseDateTimeValue event, and the following would be the values:
            args.TextToParse = <date> 1:00 PM
            args.Result = <date> 1:00 AM
            control 2's ToolTipContent property = <date> 1:00 AM
            control 2's SelectedValue property = null
        b. Second, it goes to control2's SelectionChanged event,
            e.AddedItems[0] = <date> 1:00 AM
            e.RemovedItems has no items
        c. Then, after control2's SelectionChanged event, the ParseDateTimeValue event is called again.
            args.TextToParse = <date> 1:00 PM
            args.Result = <date> 1:00 AM
            control 2's ToolTipContent property = <date> 1:00 AM
            control 2's SelectedValue property = <date> 1:00 AM
  9. George
    Admin
    George avatar
    1332 posts

    Posted 09 Aug 2010 Link to this post

    Hi LLG,

     
    Thank you for getting back to us.

    Could you please send us a running sample that reproduces the problem. It would be very helpful to investigate the problem.

    I will be glad to assist you further.

    Best wishes,
    George
    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
  10. LLG
    LLG avatar
    5 posts
    Member since:
    Apr 2010

    Posted 09 Aug 2010 Link to this post

    Hi George,

    Thanks for your reply.  See below for the xaml and cs file that demonstrates the scenario that I've described.

    XAML:

    <UserControl x:Class="SilverlightApplication2.MainPage"

        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

        xmlns:tgrid="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"

        xmlns:ti="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Input"

        mc:Ignorable="d"

        d:DesignHeight="300" d:DesignWidth="400">

     

        <Grid x:Name="LayoutRoot" Background="White">

            <tgrid:RadGridView x:Name="rgridTasks"

                                                       AutoGenerateColumns="False"

                                                       CanUserInsertRows="True"

                                                       CanUserDeleteRows="True"

                                                       ShowInsertRow="True"

                                                       IsReadOnly="False"

                                                       CanUserSortColumns="False"

                                                       ShowGroupPanel="False"  MaxHeight="300">

                <tgrid:RadGridView.Columns>               

                    <tgrid:GridViewDataColumn UniqueName="StartDate" MinWidth="95" IsFilterable="False" DataMemberBinding="{Binding dastart}"  DataFormatString="{} {0:MMM dd, yyyy h:mm tt}"  Header="Started On">

                        <tgrid:GridViewDataColumn.CellEditTemplate>

                            <DataTemplate>

                                <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">

                                    <ti:RadDateTimePicker x:Name="dtpStartDate" DisplayFormat="Short" Loaded="dtpStartDate_Loaded" SelectionChanged="dtpStartDate_SelectionChanged" Culture="en-US" ParseDateTimeValue="dtPicker_ParseDateTimeValue" />

                                </StackPanel>

                            </DataTemplate>

                        </tgrid:GridViewDataColumn.CellEditTemplate>

                    </tgrid:GridViewDataColumn>

     

                    <tgrid:GridViewDataColumn UniqueName="EndDate" MinWidth="95" IsFilterable="False" DataMemberBinding="{Binding dadue}"  DataFormatString="{} {0:MMM dd, yyyy h:mm tt}"  Header="Due On">

                        <tgrid:GridViewDataColumn.CellEditTemplate>

                            <DataTemplate>

                                <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">

                                    <ti:RadDateTimePicker x:Name="dtpEndDate" DisplayFormat="Short" Loaded="dtpEndDate_Loaded" SelectionChanged="dtpEndDate_SelectionChanged" Culture="en-US" ParseDateTimeValue="dtPicker_ParseDateTimeValue" />

                                </StackPanel>

                            </DataTemplate>

                        </tgrid:GridViewDataColumn.CellEditTemplate>

                    </tgrid:GridViewDataColumn>

     

                    <tgrid:GridViewDataColumn MinWidth="400" IsFilterable="False" DataMemberBinding="{Binding notes, Mode=TwoWay}" Header="Notes" />

                    <tgrid:GridViewDataColumn IsVisible="False" IsFilterable="False" DataMemberBinding="{Binding ispriority, Mode=TwoWay}" />

                    <tgrid:GridViewDataColumn IsVisible="False" IsFilterable="False" DataMemberBinding="{Binding idnum, Mode=TwoWay}" />

     

                </tgrid:RadGridView.Columns>

            </tgrid:RadGridView>

        </Grid>

    </UserControl>

     

     

     

     

     

    Code behind:

    using System;

    using System.Collections.Generic;

    using System.Linq;

    using System.Net;

    using System.Windows;

    using System.Windows.Controls;

    using System.Windows.Documents;

    using System.Windows.Input;

    using System.Windows.Media;

    using System.Windows.Media.Animation;

    using System.Windows.Shapes;

     

    using Telerik.Windows.Controls;

    using Telerik.Windows;

    using Telerik.Windows.Controls.GridView;

     

    using SilverlightApplication2.ServiceReference1;

    using System.Data.Services.Client;

    using System.Collections.ObjectModel;

     

    namespace SilverlightApplication2

    {

        public partial class MainPage : UserControl

        {

            private ObservableCollection<opp_task> Tasks;

     

            public MainPage()

            {

                InitializeComponent();

                Loaded += new RoutedEventHandler(MainPage_Loaded);

            }

     

            private void MainPage_Loaded(Object sender, RoutedEventArgs e)

            {

                LoadAllTasks();

            }

     

            private void LoadAllTasks()

            {

                //Get tasks from database

            }

     

            private void dtpStartDate_Loaded(object sender, RoutedEventArgs e)

            {

                RadDateTimePicker dtpicker = (RadDateTimePicker)sender;

     

                dtpicker.SetBinding(RadDateTimePicker.DateTimeTextProperty,

                    new System.Windows.Data.Binding("dastart")

                    {

                        Mode = System.Windows.Data.BindingMode.TwoWay,

                        Source = dtpicker.ParentOfType<GridViewRow>().Item

                    });

            }

     

            private void dtpStartDate_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangedEventArgs e)

            {

                RadDateTimePicker dtpicker = (RadDateTimePicker)sender;

                if (e.RemovedItems.Count > 0 && dtpicker.ParentOfType<GridViewRow>() != null) // start date changed

                {

                    DateTime oldStartDt = Convert.ToDateTime(e.RemovedItems[e.RemovedItems.Count - 1]);

                    // get opp_task object

                    opp_task task = dtpicker.ParentOfType<GridViewRow>().Item as opp_task;

                    if (task != null && e.AddedItems.Count > 0)

                    {

                        // change due date similar to start date if start is greater than due date

                        DateTime newStartDt = Convert.ToDateTime(e.AddedItems[e.AddedItems.Count - 1]);

                        if (newStartDt.Year > 1 && newStartDt > task.dadue)

                            task.dadue = newStartDt;

                        else if (newStartDt.Year == 1)

                        {

                            task.dastart = oldStartDt;

                        }

                    }

                }

            }

     

            private void dtpEndDate_Loaded(object sender, RoutedEventArgs e)

            {

                RadDateTimePicker dtpicker = (RadDateTimePicker)sender;

     

                dtpicker.SetBinding(RadDateTimePicker.DateTimeTextProperty,

                    new System.Windows.Data.Binding("dadue")

                    {

                        Mode = System.Windows.Data.BindingMode.TwoWay,

                        Source = dtpicker.ParentOfType<GridViewRow>().Item

                    });

            }

     

            private void dtpEndDate_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangedEventArgs e)

            {

                RadDateTimePicker dtpicker = (RadDateTimePicker)sender;

                if (e.RemovedItems.Count > 0 && dtpicker.ParentOfType<GridViewRow>() != null) // end date changed

                {

                    DateTime oldEndDt = Convert.ToDateTime(e.RemovedItems[e.RemovedItems.Count - 1]);

                    // get opp_task object

                    opp_task task = dtpicker.ParentOfType<GridViewRow>().Item as opp_task;

                    if (task != null && e.AddedItems.Count > 0)

                    {

                        // change start date similar to due date if due date is less than start date

                        DateTime newEndDt = Convert.ToDateTime(e.AddedItems[e.AddedItems.Count - 1]);

                        if (newEndDt.Year > 1 && newEndDt < task.dastart)

                            task.dastart = newEndDt;

                        else if (newEndDt.Year == 1)

                        {

                            task.dadue = oldEndDt;

                        }

                    }

                }

            }

     

            private void dtPicker_ParseDateTimeValue(object sender, ParseDateTimeEventArgs args)

            {

                RadDateTimePicker dtPicker = (RadDateTimePicker)sender;

                if (dtPicker != null)

                {

                    // check values

                    string toolTip = dtPicker.TooltipContent.ToString();

                    string textToParse = args.TextToParse;

                    DateTime? dtRes = args.Result;

                    DateTime? dtSel = dtPicker.SelectedValue;

                }

            }

        }

    }

     

     

     


    Thanks again!

    Regards,
    LLG
  11. George
    Admin
    George avatar
    1332 posts

    Posted 12 Aug 2010 Link to this post

    Hi LLG,

    Unfortunately, I could not find the problem in your code as long as I am not able to run and/or debug it. I made a sample running project keeping the main logic and try to reproduce the problem, but to no avail. Attached you can find the sample. 

    Please, let me know if you have the same problem with this sample and if you do - tell me the steps to reproduce it. Feel free to modify the project to reproduce the issue. That will help me a lot.

    Looking forward to your reply. I will be glad to assist you further.

    Greetings,
    George
    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
  12. LLG
    LLG avatar
    5 posts
    Member since:
    Apr 2010

    Posted 12 Aug 2010 Link to this post

    Hi George,

    Thanks for checking it out.  I don't see any attachment in your reply. Anyway, I checked again my sample project and I still see the problem.  See the attached images for the steps i made.

    Thanks!
    Regards,
    LLG
  13. George
    Admin
    George avatar
    1332 posts

    Posted 17 Aug 2010 Link to this post

    Hello LLG,

    Please accept my apologies for the missing attachment. Please check the example. I suggest you to implement your logic in the ViewModel. 

    Looking forward to your reply. I will be glad to assist you further.

    Kind regards,
    George
    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
  14. LLG
    LLG avatar
    5 posts
    Member since:
    Apr 2010

    Posted 18 Aug 2010 Link to this post

    Hi George,

    Thanks! Setting the DataContext fixed the problem.

    Regards,
    LLG
Back to Top
DevCraft banner