Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6596637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:06:05+00:00 2026-05-25T18:06:05+00:00

In Winforms, I use Fill and Dock to achieve this. I have a Page

  • 0

In Winforms, I use Fill and Dock to achieve this.

I have a “Page” where I would like to play a video file and also show the label at the bottom. I would like the page to be able to stretch and for the video to stretch and to have the label stay at the bottom of the page.

My attempts so far always results in the video covering the label when it is played. How can this be fixed?

(Other controls in the StackPanel have been omitted)

<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      x:Class="SDKSample.MediaElementExample" >

    <DockPanel LastChildFill="True">
        <MediaElement Source="media\numbers.wmv" Name="myMediaElement" 
            LoadedBehavior="Manual" UnloadedBehavior="Stop" 
            MediaOpened="Element_MediaOpened" MediaEnded="Element_MediaEnded" 
            DockPanel.Dock="Top" Margin="50" />
        <StackPanel HorizontalAlignment="Center" Orientation="Horizontal" 
                Height="30"  DockPanel.Dock="Bottom" Margin="50">
                <TextBlock Margin="5"  VerticalAlignment="Center">
                Video Label
                </TextBlock>
        </StackPanel>
    </DockPanel>
</Page>

Solution (with thanks to Daniel May):

<Grid Height="Auto">
    <Grid.RowDefinitions>
        <RowDefinition />
        <RowDefinition Height="30"/>
    </Grid.RowDefinitions>

    <MediaElement Source="media\numbers.wmv" Name="myMediaElement" LoadedBehavior="Manual" UnloadedBehavior="Stop" 
     MediaOpened="Element_MediaOpened" MediaEnded="Element_MediaEnded" />
    <StackPanel HorizontalAlignment="Center" Orientation="Horizontal" Height="30" Grid.Row="1">
        <Button Content="Button" Height="23" Name="button1" Width="75" Click="button1_Click" />
    </StackPanel>
</Grid>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T18:06:06+00:00Added an answer on May 25, 2026 at 6:06 pm

    You can achieve this using a Grid.

    <Grid Height="300" Width="300">
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="Auto"/>
    </Grid.RowDefinitions>
        <MediaElement Source="media\numbers.wmv" 
                Name="myMediaElement" 
                LoadedBehavior="Manual" 
                UnloadedBehavior="Stop" 
                MediaOpened="Element_MediaOpened" 
                MediaEnded="Element_MediaEnded" />
        <TextBlock Margin="5" 
                Grid.Row="1"
                VerticalAlignment="Center"
                Text="Video Label" />
    </Grid>
    

    Using the Height attribute on the second RowDefinition, you force that row to size to it’s contents. The preceding RowDefinition then fills the rest of the available space (in your case, your MediaElement).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this extension method I use in WinForms but would like to know
I would like to use Ninject in my WinForms application. I cannot figure out
I have a WinForms utility that I use constantly, and enhance regularly. Roughly one
I have a WinForms application that makes use of a TaskDialog library that leverages
I have a Winforms application that dynamically instantiates external form objects for use in
I have WinForms app and multiple forms and want to use ErrorProvider component on
I use a panel in c# winforms and fill the panel with the no
I have simple WinForms GUI that I want to use with TabPages. The problem
I use the same code to fill a control in my WinForms over and
It seems like when you have a WinForms .NET application, and a ComboBox (set

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.