This is a migrated thread and some comments may be shown as answers.
Webview in ListView ItemTemplate
1 Answer 33 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Rodney asked on 06 Nov 2018, 06:23 PM

I'm getting formatted html data i need to put into a list list view. My Web view is not displaying the format HTML. It show the html in plain text.

Here is my DataTemplate:

 <DataTemplate x:Key="ListViewItemTemplate">
                        <StackLayout Padding="20">
                                    <RowDefinition Height="*"/>
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="*" />

                                <Image Grid.Column="0" Grid.Row="0" Source="{Binding UserIcon}" WidthRequest="35"/>

                                <StackLayout Grid.Column="1" Grid.Row="0" Orientation="Vertical">
                                    <StackLayout Orientation="Horizontal">
                                        <Label Text="{Binding UiDisplayName}" FontFamily="SFProText#600"
                                 FontSize="17" FontAttributes="None" TextColor="#FF000000"/>
                                        <Label Text="{Binding UiTimeStamp}" FontFamily="SFProText#400" FontSize="15"
                                 FontAttributes="None" TextColor="#B36A767D" />
                                    <Label Text="{Binding Content}" />
                                    <WebView HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"
                                            Margin="0" Source="{Binding WebViewSource}" />


Any Suggestions?

1 Answer, 1 is accepted

Sort by
Lance | Manager Technical Support
Telerik team
answered on 06 Nov 2018, 07:39 PM
Hello Rodney,

Is the property a string property? You would also get the same behavior if you are using a plain ListView or even a WebView on the page by itself. The RadListView doesn't help prepare a WebView in any special way.

See this Microsoft documentation on how to use a web view with HTML string in memory by instantiating an HtmlWebViewSource. Once that is set up correctly, you will get the following result:

(screenshot of WebView in RadListView)

If you are still having trouble with using WebView and the HTML, I recommend posting this on StackOverflow or Xamarin Forums because we don't have any resources or documentation to help with plain Xamarin.Forms controls.

I hope I was able to point you in the right direction.

Lance | Tech Support Engineer, Sr.
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Asked by
Top achievements
Rank 1
Answers by
Lance | Manager Technical Support
Telerik team
Share this question