Hi people,
I was roaming the forum and SO but I could not found an existing thread that was relevant enough to me.
Does XF has a mechanism to pass an entity that gets evaluated at runtime?
From what I could understand, having a "{Static sys:DateTime.Now}"
does not do that and the date gets cached somehow. I tried to bind to a property on the VM which calls DateTime.Now
but it does not work unless I do more pipework with INotifyPropertyChanged
(messier). So I ended up to do that in the code behind which is far from ideal in a MVVM point of view but works:
[XamlCompilation(XamlCompilationOptions.Skip)]
public partial class MyPage : ContentPage
{
public MyPage ()
{
InitializeComponent();
Switch.Clicked += Switch_Clicked;
}
private void Switch_Clicked(object sender, EventArgs e)
{
if (BindingContext is MyViewModel vm)
{
vm.Switch.ExecuteCommandWith(DateTime.Now);
}
}
}
My need is as follow: binding entities that get evaluated at runtime when invoked. How to do that in xaml?