We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

SfDateSelector Styling and 'Accepted' Event Handling

Thread ID:

Created:

Updated:

Platform:

Replies:

118882 Apr 19,2015 04:56 AM Apr 24,2015 08:58 AM WinRT 7
loading
Tags: SfDatePicker
Jürgen
Asked On April 19, 2015 04:56 AM

Hi.

I like the feature of the SFDatePicker control to set the value to null, which comes in pretty handy in my app. A couple of things I haven't figured out yet:

I want the user to be able to accept a pre-selected (proposed) date. A ValueChanged event does not fire in that case because the user is not changing the date. I'd like to be able to catch the event "user confirms pre-selected date" vs. "user cancels" (date remains not set). However, when the date is not changed, tapping the checkmark is pretty much the same as tapping the cancel or back button, or is there a way to handle the accept/checkmark button tapped event?

Can I style the selector so that it fills the entire screen similar to the standard Windows DatePicker? Standard dimension and alignment properties applied to the date selector don't seem to do the trick. Only the Width property could be set to an absolute value. The Height property has no effect, and neither do the HorizontalAlignment and VerticalAlignment properties.

-Jürgen

Victory Jessie Selvam D [Syncfusion]
Replied On April 20, 2015 02:39 AM

Hi Jürgen,

Thank you for using Syncfusion products.

Query #1:is there a way to handle the accept/checkmark button tapped event?
We have prepared a sample and tried to meet your requirement. In the sample, we have retrieved the buttons from SfDateSelector using VisualTreeHelper and hooked the Tapped events.

Query #2: Can I style the selector so that it fills the entire screen?
Yes. You can style the selector to fill entire screen by setting the DropDownHeight property in SfDatePicker and Width of SfDateSelector in SelectorStyle property. Please download the sample from following link,

Sample: DateSelector.zip

Please let us know whether the provided sample meets your requirement or not.

Regards,
Jessie

Jürgen
Replied On April 20, 2015 07:02 AM


Hi Jessie.

Thank you. That looks good.

We have prepared a sample and tried to meet your requirement. In the sample, we have retrieved the buttons from SfDateSelector using VisualTreeHelper and hooked the Tapped events.

Great. That definitely does the job. Interesting phenomenon though: every time you close the selector using one of the buttons, the number of times the corresponding handler fires increases -- once the first time, twice the second time, and so on. Not a severe issue as I don't expect the user to change the date many times at once.

Yes. You can style the selector to fill entire screen by setting the DropDownHeight property in SfDatePicker and Width of SfDateSelector in SelectorStyle property. Please download the sample from following link,

OK. This requires setting the properties in code behind after determining the screen dimensions, correct? DropDownHeight is straightforward. How about setting the selector Width?

Thanks and regards,
-Jürgen







Bharadhi K [Syncfusion]
Replied On April 21, 2015 09:03 AM

Hi Jurgen,

Thank you for the update.

Query 1: every time you close the selector using one of the buttons, the number of times the corresponding handler fires increases

While checking the issue we found that the Tapped event is hooked every time the Selector is opened. We have modified the sample to resolve this. In the sample, we have defined a temporary bool variable "handled" and hooked the event only once based on the handled variable.

Query 2: This requires setting the properties in code behind after determining the screen dimensions, correct? How about setting the selector Width?

In the previous update, we had set the Width of the SfDateSelector in the SelectorStyle property to define in Xaml. We can also set the width in code-behind by retrieving the Selector from SfDatePicker and assigning the width. We have modified the sample to demonstrate the same. In the sample we have set the Width of the Selector in the dropdownpopup_Opened event.

Please find the sample in the below link.

Sample: DateSelector.zip

Please let us know if you require further assistance on this.

Regards,
Bharadhi K

Jürgen
Replied On April 22, 2015 02:57 PM

Hi Bharadhi.

Thank you for your effort and for the code sample. I very much appreciate that.

About the repeated execution of the event handlers:
Yes, thank you. I had something similar in mind, but this works very well.

About expanding the selector across the entire screen:
This works well in Windows. It almost works well on WP, except for a little offset probably caused by the status bar. Since Win8.1 getting the height of that isn't that clear. Also, it does not handle screen rotation very well. I can update the width and height attributes in a Window SizeChanged event handler but there remains a vertical offset.

Overall, this is quite a bit of tweaking needed to get a basic view. In future versions of this control, it would be good to be able to expose this via a couple of simple properties of the parent control, so this can be easily set in XAML or styled. The full-screen view is still the most usable and visually attractive, at least on a Phone.  But I understand that the priority and need for this control may have decreased a bit after Microsoft released their DatePicker (I understood it wasn't there in WinRT from the beginning). Still, the option to set the SfDatePicker value to null and show it empty is a great advantage over the standard control.

Many thanks and best regards,
-Jürgen

Victory Jessie Selvam D [Syncfusion]
Replied On April 23, 2015 09:42 AM

Hi Jürgen,

Thanks for your suggestions and we will consider your suggestions as a feature in our upcoming releases.

Regards,
Jessie

Jürgen
Replied On April 23, 2015 04:28 PM

Hi Jessie.

Thank you. I really appreciate everyone's effort. But, at the end, it either works or it doesn't - half-way isn't enough. Hooking up the accept and cancel events is absolutely cool. But right now, the SfDatePicker with default style does not look good on a Windows Phone. We did some tweaking here but it's really only half a solution. I made a feature request based on this discussion, and I would really like to see this being given some serious consideration.

Thanks and regards,
-Juergen

Victory Jessie Selvam D [Syncfusion]
Replied On April 24, 2015 08:58 AM

Hi Jürgen,

Thank you for your suggestions.

We could find that you have already created a incident with following suggestions. We request to follow up with the incident for further updates.

Please let us know if you have any questions.

Regards,
Jessie

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;