Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Prism access BindingContext from code behind

$
0
0

Hi,

I need to dynamically build TableView from code behind as I can't achieve what I want with ListView (or any other component, complex scenario).

I'm trying to access BindingContext after InitializeComponent() in xaml.cs file, but BindingContext is not populated at this point as Prism Initialize method is not yet called in view model. In the Initialize method I'm accessing server and then populate view model.

viewModel = (SomeViewModel)this.BindingContext;

Tried both OnAppearing and OnBindingContextChanged event, still same issue. From what I understand Prism will call Initialize just before pushing the view, so there is no way to use BindingContext in code behind.

Is this not possible with Prism?


Viewing all articles
Browse latest Browse all 204402

Trending Articles



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