I have a WCF service that returns a report in the form of an HTML snippet (nothing fancy, just a few tables).
Is there any simple way to render the returned HTML in a control or on the page?
If so could you show a quick example?
Thanks....
RKM
Code: Select all
private void Button_Click(object sender, RoutedEventArgs e)
{
string html = "<body>This is a new window!</body></html>";
CSHTML5.Interop.ExecuteJavaScript(
@"var oNewWin = window.open(""about:blank"", ""Report"", ""height=150,width=300,top=10,left=10,resizable=yes"");
oNewWin.document.open();
oNewWin.document.write(""<html><head><title>New Window</title></head>"");
oNewWin.document.write($0);
oNewWin.document.close();", html);
}
Code: Select all
<StackPanel>
<Button Content="Show HTML" Background="White" FontSize="22" Click="Button_Click" />
<StackPanel x:Name="stackPanel1" />
</StackPanel>
Code: Select all
public class HtmlWrapper : Windows.UI.Xaml.Controls.Control
{
public HtmlWrapper(string pHtmlToRender)
{
CSharpXamlForHtml5.DomManagement.SetHtmlRepresentation(this, pHtmlToRender);
}
}
private void Button_Click(object sender, RoutedEventArgs e)
{
string html = "<table><tr><td>This</td><td>is</td></tr><tr><td>a</td><td>test</td></tr></table>";
stackPanel1.Children.Clear();
stackPanel1.Children.Add(new HtmlWrapper(html));
}
MichaelHughes wrote:You tantalizingly mention 10.5....any estimates of the eta please
zemorango wrote:do you have any prevision for localizable resx (resources)?
Henrygo wrote:How to use the HtmlPresenter?
Please provide an example,thanks.
Code: Select all
<Page
x:Class="Application1.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:native="clr-namespace:CSHTML5.Native.Html.Controls;assembly=CSharpXamlForHtml5">
<Border>
<native:HtmlPresenter Html="<canvas id="demo_canvas" Style="width:100%;height:100%" />"/>
</Border>
</Page>
Users browsing this forum: No registered users and 9 guests