Hi,
has anyone got the UIWebView to work in a UIViewElement? I want to render an 
HTML fragment as a table row in a Monotouch.Dialog view. I have tried the 
following code...

string myHtmlFragment = "<html><body>Testing 1 2 3</body></html>";
UIWebView web = new UIWebView(){};
web.LoadHtmlString(myHtmlFragment, null);
UIViewElement element = new UIViewElement("My Caption", web, false);
m_MySection.Add(element);

But I get a row which is about 1 pixel high.  So I added the following but it 
didn't help.

web.LoadFinished += (sender1, e1) =>
{
     web.SizeToFit();
};

I read that I should inherit UIViewElement and implement IElementSizing. So I 
tried that (replacing UIViewElement in the above code with UIViewElementSizing.

public class UIViewElementSizing : UIViewElement, IElementSizing
{
    //ctor omitted - it just passes everything through.

  float IElementSizing.GetHeight(UITableView tableview, NSIndexPath path)
    {
        return 50;
    }
}

Now I get a row of the same height as the others in my view, but it just displays the 
caption "My Caption" and not the web view.

There are no examples I could find or documentation on how to use 
UIViewElement.  Any pointers would be gladly accepted.

Cheers,
Felix
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to