Skip to main content

Microsoft Silverlight

Unanswered Question Silverlight control is wiped out after fired event to a script that sets focus to input controlRSS Feed

(0)

jjy2
jjy2

Member

Member

354 points

155 Posts

Silverlight control is wiped out after fired event to a script that sets focus to input control

 

Silverlight control is wiped out (Everything goes white as if it were removed from HTML page) after fired event to a script that sets focus to input control.  Then it re-appear when resized IE browser.

 Firefox works fine. Steps to reproduce this behaviour--------Managed Code:
input = HtmlPage.Document.CreateElement("input");
input.ID = "mygeneratedid";
input.SetStyleAttribute("position", "absolute");
input.SetStyleAttribute("zIndex", "1");
input.SetStyleAttribute("fontSize", "10px");
input.SetStyleAttribute("border-width", "1px");
HtmlPage.Document.GetElementsByTagName("body")[0].AppendChild(input);
input.SetStyleAttribute("left", left.ToString("F0") + "px");
input.SetStyleAttribute("top", top.ToString("F0") + "px");
input.SetStyleAttribute("width", (this.Width - 6).ToString("F0") + "px");
input.SetStyleAttribute("height", (this.Height - 6).ToString("F0") + "px");
input.SetStyleAttribute("visibility", "visible");input.SetStyleAttribute("display", "");
input.SetProperty("value", this.textBlock.Text);
//Once created HTML input control, give it a focus
//This function simply fires an event to javascript
SetFocusToHtmlElement (input.ID);   

-------- Java script:

function onElementGotFocus (id)
{
           
    var element = document.getElementById(id);
           
   
element.focus();
//BANG! Silverlight goes white 
    
//Can't see anything but this text box that is focused
   
//Then, silverlight reappear when the IE browser is resized.                     
}

FYI, If I set the focus to HTML input text that is static (i.e not created by Silverlight) it works just fine in IE.
Both works fine in FF
 

 

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities