0
votes

I have a user control in my wpf application. and inside this user control i have web browser control.

when I navigate to some web page, it is not showing up anything. I can see that http call is happening and navigated event of web browser control is firing. but nothing is showing up.

Any help would be appreciated.

XAML looks like this

<UserControl 
   x:Class="Client.Module.LmpView" 
   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
   xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"  
   xmlns:d="http://schemas.microsoft.com/expression/blend/2008"  
   mc:Ignorable="d" 
   DataContextChanged="UserControl_DataContextChanged" 
   xmlns:module="clr-namespace:Client.Module" 
   xmlns:WinForms="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms">
   <!--
   <StackPanel>
      <WindowsFormsHost x:Name="wfh" Width="400" Height="400"/>
   </StackPanel>
   -->
   <TextBlock>
      <WebBrowser Width="400"  Height="400" Navigated="LinkedInProfileDisplayControl_Navigated"  x:Name="LinkedInProfileDisplayControl"  AllowDrop="True"  />
   </TextBlock>
</UserControl>

Code behind file

private void UserControl_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
{
    if (this.DataContext != null)
    {
        LinkedInProfileDisplayControl.Navigate((this.DataContext as LinkedInMemberProfileViewModel).LinkedInMemberProfileUrl);
    }
}
1
With 1.5k rep you should know that you will not get a good answer without code. I'm not good at this mind-reading-over-tcp/ip-thing, but let me try... ... ... Line 168. You need to fix line 168.nvoigt
@Relativity why WebBrowser is part of TextBlock? Did you try removing TextBlock and leaving just WebBrowser?dkozl
I did try that - it didnt workRelativity

1 Answers

0
votes

try any of these:

1) make sure you have no AllowsTransparency="true" anywhere

2) see if LinkedInProfileDisplayControl.Navigate("http://google.com") works

3) make sure WebBrowser is actually showing, set its Visibility=Visible.

4) see if it works when you detach from navigated event.

5) Use snoop to inspect visual tree.