Thursday, December 30, 2010

Crop the webbrowser control in a Windows Phone 7 app

When building my Windows Phone 7 app – I needed to login into LinkedIn – unfortunately the login page of LinkedIn does not seem to scale as well as the Twitter login page so I decided to only show a specific part of the page within the WebBrowser control for Windows Phone. I kind of got it working by using the Clip property (for reference see How to: Crop an object (Silverlight))

<phone:WebBrowser HorizontalAlignment="Stretch" 
Name="webBrowser1" VerticalAlignment="Stretch" Height="466" Width="480"
IsScriptEnabled="True" Visibility="Collapsed">
<phone:WebBrowser.Clip>
<RectangleGeometry Rect="0,0,400,300" />
</phone:WebBrowser.Clip>
</phone:WebBrowser>




1 comment:

Anonymous said...

Check this helpful link too it also explained very well about WebBrowser control in windows phone 7 development....
http://www.mindstick.com/Articles/e5957dee-a494-47da-9cd5-61fb870c02e2/?WebBrowser%20Control%20in%20Windows%207%20Phone%20Development

http://dotnet.dzone.com/news/windows-phone-7-development

sonaswet