Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebBrowser and Windows Background #1038

Closed
myCollections opened this issue Feb 17, 2014 · 6 comments
Closed

WebBrowser and Windows Background #1038

myCollections opened this issue Feb 17, 2014 · 6 comments
Labels

Comments

@myCollections
Copy link

Hello,

When i use a WebBrowser inside a border with a windows background i get a margin issue (see picture).
Any clue on this ?
browser

<controls:MetroWindow x:Class="myCollections.Pages.Browser"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
    xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
    xmlns:behaviours="http://metro.mahapps.com/winfx/xaml/shared"
    Height="600" Width="1024" 
    Style="{DynamicResource MetroWindow}" ShowCloseButton="True"          
    Loaded="Window_Loaded" WindowStartupLocation="CenterScreen">

    <i:Interaction.Behaviors>
        <behaviours:BorderlessWindowBehavior ResizeWithGrip="True" AllowsTransparency="False" />
    </i:Interaction.Behaviors>
    <Grid>
        <Border BorderBrush="{DynamicResource AccentColorBrush}" Margin="1,30,1,1" BorderThickness="2">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <WebBrowser Name="LocalBrowser" />
            </Grid>
        </Border>
    </Grid>
</controls:MetroWindow>

Thanks

@AzureKitsune
Copy link
Member

@myCollections Only thing that looks odd to me (and since I have no other place to start)... is with your RowDefinitions/ColumnDefinitions. Why are they /there/? Without them, the WebBrowser should fill the Grid.

If not, setting HorizontalAlignment and VerticalAlignment to Stretch might do the trick.

@myCollections
Copy link
Author

Hello @Amrykid,

I removed the grid

<controls:MetroWindow x:Class="myCollections.Pages.Browser"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
    xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
    xmlns:behaviours="http://metro.mahapps.com/winfx/xaml/shared"
    Height="600" Width="1024" ShowCloseButton="True" ShowTitleBar="True" TitleCaps="False"
    Style="{DynamicResource MetroWindow}" Loaded="Window_Loaded" WindowStartupLocation="CenterScreen">

    <i:Interaction.Behaviors>
        <behaviours:BorderlessWindowBehavior ResizeWithGrip="True" AllowsTransparency="False" />
    </i:Interaction.Behaviors>
    <WebBrowser Name="LocalBrowser" />
</controls:MetroWindow>

But i still get the issue.

browser2

@AzureKitsune
Copy link
Member

@myCollections Hmm... try setting WindowTransitionsEnabled on your MetroWindow to false.

@myCollections
Copy link
Author

@Amrykid Thanks, it works 👍

@AzureKitsune
Copy link
Member

@myCollections Do you mind if I use your screenshot on our Frequently Asked Questions page?

@myCollections
Copy link
Author

@Amrykid No problem, thanks for you great work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants