I'm navigating to a view. I have an EventDateTime property which I want to set to DateTime.Today unless the navigation is coming from MyCustomViewThis is what I've come with so far. It's working, but I find this really ugly:public void OnNavigatedTo(NavigationParameters parameters){    if (parameters != null)    {        if (!parameters.ContainsKey(PARAM_NAVIGATEDFROM)) // If there is parameter PARAM_NAVIGATEDFROM, then the navigation doesn't come from MyCustomView        {            EventDateTime = DateTime.Today;        }        else if (parameters[PARAM_NAVIGATEDFROM] != typeof(MyCustomViewModel)) // If there is a parameter PARAM_NAVIGATEDFROM but not with the specific value, the navigation doesn't come from MyCustomView        {            EventDateTime = DateTime.Today;        }    }    else // If there are no parameters at all, the navigation is not coming from MyCustomView either    {        EventDateTime = DateTime.Today;    }}Any ideas how I can improve this Code? Maybe even with another approach instead of putting the Code into the OnNavigatedTo() method?
Navigating to a view
c#
I think Bethan has the best approach, but you could take it one step further and use a generic Type:public void OnNavigatedTo(NavigationParameters parameters){    if (!IsNavigationFrom<MyCustomView>(parameters))    {        EventDateTime = DateTime.Today;    }}private bool IsNavigationFrom<T>(NavigationParameters parameters){    return parameters != null        && parameters.ContainsKey(PARAM_NAVIGATEDFROM)        && parameters[PARAM_NAVIGATEDFROM] == typeof(T);}This makes the method applicable to multiple view models.