Select to view content in your preferred language

Maptip that contains web browser (WPF)

477
3
05-24-2011 09:01 AM
JoshuaCorcoran
Emerging Contributor
WPF: I have created a user control that contains the code below. I then set this user control to the maptip of a graphicslayer. When the maptip opens I click the Test button and I tell that google.com is loading. You can never see the content though you can right click in the area where the browser should be and get the properties and view the html content. Why is the content of the browser invisble. Thanks.

XAML:

<UserControl x:Class="MyApplication.frmMaptip" 
                  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                  xmlns="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid>
<StackPanel Background="White">
<Border BorderBrush="Black" BorderThickness="2">
<WebBrowser Height="170" Width="400" Name="webBrowser1" VerticalAlignment="Top"/>
<Button Height="25" Width="75" Content="Test" Click="Button_Click"/>
</Border>
</StackPanel>
</Grid>

</UserControl>


C#:
private void Button_Click(object sender, RoutedEventArgs e)
{
  this.webBrowser1.Navigate("http://www.google.com");
}
0 Kudos
3 Replies
JenniferNery
Esri Regular Contributor
This seems to be a known issue in WPF: http://social.msdn.microsoft.com/Forums/en/wpf/thread/cd8416be-deb0-496f-9e22-02e44e8073c0

WebBrowser within a Popup that has AllowTransparency=True (which is what GraphicsLayer.Maptip is) has render issues. The 2nd blog post there offers a workaround.
0 Kudos
JoshuaCorcoran
Emerging Contributor
Jennifier,

The workaround listed was for use with Windows not user controls. I guess though if this is a known WPF bug there is not much I can do about it. Do you know of any WPF controls that can render html adverse to an embeded browser?

V/R,

Joshua
0 Kudos
BrianLocke
Frequent Contributor
this is a Jury Rig but seems to be working,

public partial class usercontrolMaptip : UserControl
{
        public usercontrolMaptip();
        {
            InitializeComponent();
            Loaded += usercontrolMaptip_Loaded;
        }

        private void usercontrolMaptip_Loaded(object sender, RoutedEventArgs e)
        {
            var popParent = Parent as Popup;
            if (popParent == null) return;
            popParent.AllowsTransparency = false;
            popParent.IsOpen = false;
            Loaded -= IdentifyMapTips_Loaded;

}
0 Kudos