Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 89864

ViewModelLocator reference in XAML?

$
0
0

Hi,

I am using MVVM Light with the ViewModelLocator. I would like to avoid setting the view model in the code behind using a line such as this:

BindingContext = ((ViewModelLocator)Application.Current.Resources["ViewModelLocator"]).Menu;

I would have expected this line to work:

ContentPage xmlns="http://xamarin.com/schemas/2014/forms" [...]
            BindingContext="{x:DynamicResource ViewModelLocator.Menu}">

The ViewModelLocator is resolved, but as soon as I put .Menu at the end, the binding is not resolved.

Also, is it possible to have some debug informations on binding? In WPF, we have diag:PresentationTraceSources.TraceLevel=High. Is there something similar in Xamarin?

Thank you!


Viewing all articles
Browse latest Browse all 89864

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>