Am using framework catel, update the value in the timer send an event to the fact that the content is updated, but no changes occur. The data in the listbox are updated successfully. What's the problem? XAML:
<TextBlock Margin="2,0" VerticalAlignment="Center" Text="{Binding NowPlayingTime}" />
C#:
void _dispatcherTimer_Tick(object sender, EventArgs e)
{
AboveTime = string.Format("{0:hh:mm:ss}", TimeSpan.FromMilliseconds(_controlPlayer.NaturalDurationTimeSpan));
NowPlayingTime = string.Format("{0:hh:mm:ss}", TimeSpan.FromMilliseconds(_controlPlayer.NowPlayingPosition));
}
public string NowPlayingTime
{
get { return _nowPlayingTime; }
private set
{
_nowPlayingTime = value;
RaisePropertyChanged(() => NowPlayingTime);
}
}
Found a solution to the problem, if you use this code, everything is updated and working successfully.
private void _dispatcherTimer_Tick(object sender, EventArgs e)
{
AboveTime = string.Format("{0:hh\\:mm\\:ss}", _controlPlayer.NaturalDurationTimeSpan);
NowPlayingTime = string.Format("{0:hh\\:mm\\:ss}", _controlPlayer.NowPlayingPositionTimeSpan);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.