I'm trying to set the DataTemplate of a ListView to a WebView. Actually a ViewCell containing a WebView, and bind the HTML of the web view to data property. However, it shows nothing. The ListView is blank. Anybody help? Below is my code.
var dtPDL = new DataTemplate(typeof(HomeListWebViewCell));
var lvPDL = new ListView
{
ItemsSource = ViewModel.TestPDLList(),
DataTemplate = dtPDL
};
public class HomeListWebViewCell : ViewCell
{
public HomeListWebViewCell()
{
var wv = new WebView();
var wvs = new HtmlWebViewSource();
wvs.SetBinding(HtmlWebViewSource.HtmlProperty, "MainText");
wv.Source = wvs;
this.View = wv;
}
}