So i have simple Label
that i am update via Timer
:
<Label Name="lblElapsedTime"
Content="{Binding Converter={StaticResource ElapsedTimeConverter}}"/>
Timer tick:
StopWatch StopWatch = new StopWatch();
private void progressTimer_Tick(object sender, EventArgs e)
{
lblElapsedTime.Content = string.Format("{0:00}:{1:00}:{2:00}:{3:00}:{4:00}",
StopWatch.Elapsed.Days,
StopWatch.Elapsed.Hours,
StopWatch.Elapsed.Minutes,
StopWatch.Elapsed.Seconds,
StopWatch.Elapsed.Milliseconds / 10);
}
Now i want to replace this Timer
and maybe write simple Converter
to update my Label
.
Any ideas how to implement this ?
Currently i wrote this inside Window.Resources
:
<Convertors:ElapsedTimeConverter x:Key="ElapsedTimeConverter"/>
And i have of course this Converter
but is is it possible to update my StopWatch
after restart it without Timer
?
This is my convert:
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return "";
}
The problem is that although i binding this Convert
into my Label
this Convert not even executed.