Xamarin Forms - How to make Datime.Now dynamic?

1

How to make the Datime.Now dynamic in xamarin forms? I need time to keep running. In this case it is stopped.

I have a Label that captures the data of a class

Label Text="{Binding data}" TextColor="Blue" >HorizontalOptions="CenterAndExpand"/>

public static Tempo getTempo()
{
            var tempo = new Tempo() { data = DateTime.Now };
            return tempo;
}

In the end I instantiate

 public EstiloDinamico()
 {
      InitializeComponent();
      var tempo = tempoViewModel.getTempo();
      tvm = new tempoViewModel(tempo);
      BindingContext = tvm;
}
    
asked by anonymous 08.09.2017 / 00:55

1 answer

0

You need to give a setProperty to tell the view that you had a change in the variable implements the class: BindableBase and an example of what your variable would look like

private string _title;
public string Title
{
    get { return _title; }
    set { SetProperty(ref _title, value); }
}

Whenever there is a change within the variable it will flag to the view and will be changed.

    
28.11.2017 / 14:54