Call a function when the TimeSpanPicker is Closed?

Nov 13, 2011 at 1:09 PM

Is there any way to trigger a function call when the TimeSpanPicker is closed? like changing the Click event handler of the App bar buttons?

or is there any function that behaves like MessageBox's dialog result or something?

and another question, is there any way to limit the TimeSpanPicker to just pick the less minutes & seconds picker without showing the hour section?

Coordinator
Nov 15, 2011 at 3:01 AM

Question 1:  This is a control based on the SL Toolkit so it should act just like their Date and Time pickers do.  There is no event to determine when it opens and closes but you can leverage some built events on the page and the control to determine this.

  1. Have a bool on page saying "picker is open" that is set on the Tap event for the picker.
  2. leverage the override void OnNavigatedTo event for the page and check if your picker is open.  If it is, then you know you came back from an open picker event.
  3. if you do the valuechanged event on the picker itself, you have an easy way to know if the value actually changed.

Question 2:  See Timespan.xaml in the test app.  So if you only want minutes to show up, something like this would cause the action how you want it: 

<TextBlock>Max 30min, Step 5 min</TextBlock>

 

 
 

<c4fSlToolkitExtender:TimeSpanPicker Max="{Binding TimeSpan30Min}" Step="{Binding TimeSpan5Min}"/> 

and in code behind;

public

TimeSpan TimeSpan5Min { get { return TimeSpan.FromMinutes(5); } }

 

public TimeSpan TimeSpan30Min { get { return TimeSpan.FromMinutes(30); } }

Nov 15, 2011 at 3:26 AM
Thank you. Will look into that..


From: [email removed]
To: [email removed]
Date: Mon, 14 Nov 2011 19:01:27 -0800
Subject: Re: Call a function when the TimeSpanPicker is Closed? [coding4fun:279267]

From: crutkas
Question 1: This is a control based on the SL Toolkit so it should act just like their Date and Time pickers do. There is no event to determine when it opens and closes but you can leverage some built events on the page and the control to determine this.
  1. Have a bool on page saying "picker is open" that is set on the Tap event for the picker.
  2. leverage the override void OnNavigatedTo event for the page and check if your picker is open. If it is, then you know you came back from an open picker event.
  3. if you do the valuechanged event on the picker itself, you have an easy way to know if the value actually changed.
Question 2: See Timespan.xaml in the test app. So if you only want minutes to show up, something like this would cause the action how you want it:

<TextBlock>Max 30min, Step 5 min</TextBlock>



<c4fSlToolkitExtender:TimeSpanPicker Max="{Binding TimeSpan30Min}" Step="{Binding TimeSpan5Min}"/>
and in code behind;

public
TimeSpan TimeSpan5Min { get { return TimeSpan.FromMinutes(5); } }


public TimeSpan TimeSpan30Min { get { return TimeSpan.FromMinutes(30); } }

Read the full discussion online.
To add a post to this discussion, reply to this email (coding4fun@discussions.codeplex.com)
To start a new discussion for this project, email coding4fun@discussions.codeplex.com
You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.
Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com