I use catel framework, update the value in the timer while sending an event that the content is updated, but no changes occur. What is 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); } } 

Both methods do not update the values, neither AboveTime nor AboveTime .

  • Why don't you use white magic ? - bodynar
  • White magic is absolutely useless here; updating the list works fine for me, but the text of the block does not want to update the data. - LLENN
  • Or maybe you have a DataContext not installed? For example, maybe the NowPlayingTime property is in your window or user control, and in DataContext a VM object? - VladD 4:26 pm

1 answer 1

I found a solution to the problem, the format of the string was not specified correctly, this is how everything works 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); }