Hi,
I cannot reproduce your problem with following code:
XAML:
<Window x:Class="WpfApp1.Window108"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApp108"
mc:Ignorable="d"
Title="AntoBAro-5632_220216" Height="450" Width="800">
<Window.DataContext>
<local:ViewModel/>
</Window.DataContext>
<StackPanel>
<TextBlock Text="{Binding NumRig}" />
</StackPanel>
</Window>
and classes:
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Windows;
namespace WpfApp108
{
public class ViewModel : ViewModelBase
{
public ViewModel() => Start();
private string _NumRig;
public string NumRig
{
get { return _NumRig; }
set
{
_NumRig = value;
base.OnPropertyChanged("NumRig");
}
}
void Start()
{
Timer t = new Timer(CB, null, 0, 500);
}
private void CB(object state)
{
NumRig = DateTime.Now.ToString("HH:mm:ss");
}
}
public class ViewModelBase : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
internal void OnPropertyChanged([CallerMemberName] string nameProp = "") =>
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameProp));
}
}