Note that there are some explanatory texts on larger screens.

plurals
  1. POWebBrowser control doesn't populate on first iteration if loading two controls
    primarykey
    data
    text
    <p>The issue I am having is I have a WebBrowser control called "Browser." The browser is populated from a different controls created by MEF:</p> <pre><code> //Apply Button that cretes the HTML that is loaded into the Browser btnCreateHTMLPreview(object sender, RoutedEventArgs e) { //Clears the content of the observable collection contents.Clear(); //usedControls is an observable collection of all loaded controls in the stack panel foreach(var control in usedControls) control.CreateHTML(); } //Code in the MEF Control that creates the HTML that is will be loaded into the browser CreateHTML() { string tempStuff = null; tempStuff += "&lt;h1&gt;" + MyControl.lblHeader.Content + "&lt;/h1&gt;\n"; tempStuff += MyControl.txtTextGoesHere.Text + "\n"; //Give the HTML back to the Application parent.AcceptReport(tempStuff); } //Application side where it accepts the HTML and loads it into the Browser AcceptHTML(string passedInContent) { //Observable collection that holds the content of all possible MEF Controls contents.Add(passedInContent); string tempStuffForBrowser = null; tempStuffForBrowser = "&lt;html&gt;\n"; tempStuffForBrowser += "&lt;body&gt;\n"; //Add the content that was saved earlier foreach (var strInd in contents) tempStuffForBrowser += strInd; tempStuffForBrowser = "&lt;html&gt;\n"; tempStuffForBrowser += "&lt;body&gt;\n"; Browser.NavigateToString(tempStuffForBrowser); } </code></pre> <p>I did my best above to try and provide the meat of how I am populating the html and add that back into the browser. If there is anything that is unclear please just let me know.</p> <p>If I have just one control added so that "content" only has the one control in it when I click the button to load the html, it works just fine and loads it in. However if I have more than one control loaded, I have to click that button twice to get it to show. I found this extremely bizarre. My attempt to solve this was to check and see if there was content in the Browser before leaving the event, but I am unsure how to do this. If anyone has any suggestions or any other ideas on how to solve this problem please let me know.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload