Remove a grid from window using WPF

Total Post:25

Points:175
C# 
C#
 1347  View(s)
Ratings:
Rate this:

I have a Grid in my WPF application :

<Grid Name="MainGrid">
    <Grid.RowDefinitions>
        <RowDefinition Height="70" Name="BarRowDef" />
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>
    <Grid Name="BarGrid" Grid.Row="0" Height="70" VerticalAlignment="Top" Background="#FF802C2C">
        <Button Content="History" Focusable="False" Width="100" Height="60" HorizontalAlignment="Left" VerticalAlignment="Center" Name="HistoryButton" Click="HistoryButton_Click"/>
    </Grid>
    <Grid Name="MiddleGrid" Grid.Row="1">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <WebBrowser HorizontalAlignment="Stretch" Name="Browser" VerticalAlignment="Stretch" LoadCompleted="Finish_Load" Grid.Column="1"/>
    </Grid>
</Grid>

And i want to the browser will have full screen option. So what i done is in the event Of EnterFullscreen is called is :

BarRowDef.Height = new GridLength(0);

And what happen is that the Browser start from the top of the page but in the bottom i have a white space in the size of BarGrid. Any idea what can be the problem?

  1. Post:29

    Points:203
    Re: Remove a grid from window using WPF

    I am not sure what do you mean, EnterFullscreen event of what?

    You can try this:

    BarGrid.Visibility = Visibility.Hidden;

    instead of:

    BarRowDef.Height = new GridLength(0);

      Modified On Apr-03-2018 04:52:02 AM

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!