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

TimePicker Close Button and Click Event

4 Answers 314 Views
Calendar, DateTimePicker, TimePicker and Clock
This is a migrated thread and some comments may be shown as answers.
Saif
Top achievements
Rank 2
Saif asked on 26 Jun 2014, 06:37 AM
Hi,

How to hide the Close Button part?
And what is the event to capture the click event on time?
I want to close the selection of time after selecting time.

Thanks.

4 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 26 Jun 2014, 10:15 AM
Hi Saif,

Thank you for writing.

To hide the footer you can set the respective element's Visibility property:
radTimePicker1.TimePickerElement.PopupContentElement.FooterPanel.Visibility = ElementVisibility.Collapsed;

To handle the click on the hours visual element, you can use the following snippet:
radTimePicker1.TimePickerElement.PopupForm.MouseDown += radTimePicker1_MouseDown;
 
…..
 
void radTimePicker1_MouseDown(object sender, MouseEventArgs e)
{
    TimeTableVisualElement clickedElement =                    radTimePicker1.TimePickerElement.PopupContentElement.ElementTree.GetElementAtPoint(e.Location) as TimeTableVisualElement;
    if (clickedElement != null)
    {
        if (clickedElement.FindAncestor<TimeTableElementHours>() != null)
        {
            //you have clicked hour element
        }
    }
}

I hope that you find this information useful.

Regards,
Stefan
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Saif
Top achievements
Rank 2
answered on 26 Jun 2014, 11:41 AM
Hi Stefan,

Thanks a lot.
0
Saif
Top achievements
Rank 2
answered on 09 Aug 2014, 06:52 AM
Hi again..
How can i apply above code in GridView?

GridViewDateTimeColumn timecolumn = new GridViewDateTimeColumn();
timecolumn.EditorType = GridViewDateTimeEditorType.TimePicker;

Thanks
0
Stefan
Telerik team
answered on 11 Aug 2014, 08:56 AM
Hello Saif,

To access the time editor in RadGridView you should use the CellEditorInitialized event:
void radGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e)
{
    GridTimePickerEditor timeEditor = e.ActiveEditor as GridTimePickerEditor;
 
    if (timeEditor != null)
    {
        RadTimePickerElement timeElement = (RadTimePickerElement )timeEditor.EditorElement;
        timeElement.PopupContentElement.FooterPanel.Visibility = ElementVisibility.Collapsed;
 
        timeElement.PopupForm.MouseDown -= radTimePicker1_MouseDown;
        timeElement.PopupForm.MouseDown += radTimePicker1_MouseDown;
    }
}
 
void radTimePicker1_MouseDown(object sender, MouseEventArgs e)
{
    RadTimePickerPopup popup = (RadTimePickerPopup)sender;
    TimeTableVisualElement clickedElement = popup.ContentElement.ElementTree.GetElementAtPoint(e.Location) as TimeTableVisualElement;
    if (clickedElement != null)
    {
        if (clickedElement.FindAncestor<TimeTableElementHours>() != null)
        {
            //you have clicked hour element
        }
    }
}

Off topic, may I please ask you to separate the questions that are not related to each other in separate threads, in order to make it easier to search in the forums.

Thank you for the understanding. I hope that you find the provided information useful.

Regards,
Stefan
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
Calendar, DateTimePicker, TimePicker and Clock
Asked by
Saif
Top achievements
Rank 2
Answers by
Stefan
Telerik team
Saif
Top achievements
Rank 2
Share this question
or