If IFRAME is embedded in a common webpage, Baidu can easily find the highly adaptive IFRAME solution in this scenario.
However, when silvelight is embedded, the parent page of IFRAME is embedded by default.Don't knowThe actual height of the Silverlight content, so the above method does not work.
In fact, you just need to change your mind: Since the parent page does not know the SL height in IFRAME, cannot the SL manually report its height to the parent page?
First look at the final effect:
Note: page1 and page3 are all usercontrol in SL.
CodeSee the followingSource code:
The main steps are as follows:
1. SL actively reports the height of the current SL page through JS interaction with the parent page in page_loaded of each page
2. Use js to dynamically adjust the IFRAME/frame height after the parent page gets the height
Sample source code: http://files.cnblogs.com/yjmyzz/SL_Iframe_Height_Sample.7z