TimePicker.TimeChanged Evento
Definición
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Se produce cuando cambia el valor de la propiedad Time
.
// Register
event_token TimeChanged(EventHandler<TimePickerValueChangedEventArgs> const& handler) const;
// Revoke with event_token
void TimeChanged(event_token const* cookie) const;
// Revoke with event_revoker
TimePicker::TimeChanged_revoker TimeChanged(auto_revoke_t, EventHandler<TimePickerValueChangedEventArgs> const& handler) const;
public event System.EventHandler<TimePickerValueChangedEventArgs> TimeChanged;
function onTimeChanged(eventArgs) { /* Your code */ }
timePicker.addEventListener("timechanged", onTimeChanged);
timePicker.removeEventListener("timechanged", onTimeChanged);
- or -
timePicker.ontimechanged = onTimeChanged;
Public Custom Event TimeChanged As EventHandler(Of TimePickerValueChangedEventArgs)
<TimePicker TimeChanged="eventhandler" />
Tipo de evento
Ejemplos
<TimePicker TimeChanged="TimePicker_TimeChanged"/>
<TextBlock x:Name="resultText"/>
private void TimePicker_TimeChanged(object sender, TimePickerValueChangedEventArgs e)
{
DateTime myTime = DateTime.Today + e.NewTime;
var timeDiff = e.NewTime - e.OldTime;
if (DateTime.Now >= myTime)
{
resultText.Text = "Your selected time has already past.";
}
else
{
string hrs = (myTime - DateTime.Now).Hours.ToString();
string mins = (myTime - DateTime.Now).Minutes.ToString();
resultText.Text = string.Format("Your selected time is {0} hours, {1} minutes from now.", hrs, mins);
}
}