TimePicker Close Button and Click Event

5 posts, 0 answers
  1. Saif
    Saif  avatar
    30 posts
    Member since:
    Apr 2014

    Posted 26 Jun 2014 Link to this post

    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.
  2. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 26 Jun 2014 Link to this post

    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.
     
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Saif
    Saif  avatar
    30 posts
    Member since:
    Apr 2014

    Posted 26 Jun 2014 Link to this post

    Hi Stefan,

    Thanks a lot.
  5. Saif
    Saif  avatar
    30 posts
    Member since:
    Apr 2014

    Posted 09 Aug 2014 Link to this post

    Hi again..
    How can i apply above code in GridView?

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

    Thanks
  6. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 11 Aug 2014 Link to this post

    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.
     
Back to Top
UI for WinForms is Visual Studio 2017 Ready