Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

C# WPF - WinForms Web Browser Styling

$
0
0

I have a WinForms WebBrowser within a WPF Modal Dialog window.

I also have a template defined for all of my modal dialog windows:

<ControlTemplate x:Key="ModalViewTemplate" TargetType="{x:Type Window}">
  <AdornerDecorator>
   <Border
    CornerRadius="10"
    BorderBrush="Gray"
    BorderThickness="3"
    Background="Beige"
    Margin="24"
    Padding="4">
    <Border.Effect>
     <DropShadowEffect
      Color="Gray"
      Opacity=".5"
      ShadowDepth="16" />
    </Border.Effect>
    <Grid>
     <Grid.RowDefinitions>
      <RowDefinition Height="Auto"/>
      <RowDefinition Height="0.93*"/>
      <RowDefinition Height="Auto"/>
     </Grid.RowDefinitions>

     <Grid.ColumnDefinitions>
      <ColumnDefinition Width="0.21*"/>
      <ColumnDefinition Width="0.79*"/>
     </Grid.ColumnDefinitions>

     <TextBlock
      Grid.ColumnSpan="2"
      Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=Title}"
      FontSize="16"
      FontWeight="UltraBold" />
     <ContentPresenter
      Grid.ColumnSpan="2"
      Grid.Row="1"
      Margin="10,5"
      />
     <ResizeGrip
      HorizontalAlignment="Right"
      x:Name="WindowResizeGrip"
      VerticalAlignment="Bottom"
      IsTabStop="False"
      Visibility="Collapsed"
      Grid.Column="1"
      Grid.Row="2"
      />
    </Grid>
   </Border>
  </AdornerDecorator>

  <ControlTemplate.Triggers>
   <MultiTrigger>
    <MultiTrigger.Conditions>
     <Condition Property="ResizeMode" Value="CanResizeWithGrip"/>
     <Condition Property="WindowState" Value="Normal"/>
    </MultiTrigger.Conditions>
    <Setter Property="Visibility" TargetName="WindowResizeGrip" Value="Visible"/>
   </MultiTrigger>
  </ControlTemplate.Triggers>
 </ControlTemplate>

.... and this style definition:

 <Style
  x:Key="ModalViewStyle"
  TargetType="{x:Type view:ModalView}">
  <Setter Property="AllowsTransparency" Value="True" />
  <Setter Property="WindowStyle" Value="None" />
  <Setter Property="Background" Value="Transparent" />
  <Setter Property="ResizeMode" Value="CanResizeWithGrip" />
  <Setter Property="Template" Value="{StaticResource ModalViewTemplate}" />
 </Style>

If I apply the style to this dialog the contents of the web browser control are not visible. If I remove the reference to the style, an un-styled window appears containing all of the desired web content.

I trying to understand what entry within this template/style definition is the cause of this issue.
I looked at creating a style/skin for the WebBrowser control but those properties do not exist.

I cannot use the WPF WebBrowser because it does not contain the functionality required by my application.

What should I be looking for?


Tom Mann MCSD C#


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>