Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using the following code to go to full screen mode with F11 key.

C#
if (!isFullScreenModeEnabled)
                {
                   gridMediaPlayer.Children.Remove(mePlayerMain);

                    mePlayerMain.Width = System.Windows.SystemParameters.PrimaryScreenWidth;
                    mePlayerMain.Height = System.Windows.SystemParameters.PrimaryScreenHeight;

                    this.Content = mePlayerMain;
                    this.WindowStyle = WindowStyle.None;
                    this.WindowState = WindowState.Maximized;
                    isFullScreenModeEnabled = true;
                }


First I removed my MediaElement (mePlayerMain) from Grid Control (gridMediaPlayer). Then I set the content to current media element i have. then I maximize the media element with BorderStyle None.

This absolutely works fine. But the problem is while I want to come out from Full Screen Mode. I wrote following code:

C#
if(isFullScreenModeEnabled)
                {
                    gridMediaPlayer.Children.Insert(0, mePlayerMain);
                    this.Content = gridMediaPlayer;
                    this.WindowStyle = WindowStyle.SingleBorderWindow;
                    this.WindowState = WindowState.Normal;
                    isFullScreenModeEnabled=false;
                }

But it's not working.

My another question is How can I get to the Control (Play Pause Seek etc.) while in Full Screen Mode??
Posted
Updated 5-Nov-11 4:46am
v2

1 solution

OK. I have solved it by myself and it's perfectly working on my PC.

C#
if (!isFullScreenModeEnabled)
{
//Disconnect Media Element from Parent Container Grid (gridMediaPlayer)
    gridMediaPlayer.Children.Remove(mePlayerMain);
//Get The Monitor/Display Width in Pixels
    mePlayerMain.Width = System.Windows.SystemParameters.PrimaryScreenWidth;
//Get The Monitor/Display Height in Pixels
    mePlayerMain.Height = System.Windows.SystemParameters.PrimaryScreenHeight;
//Set the current content to MediaElement    
    this.Content = mePlayerMain;
//Maximize the Media Element
    this.WindowStyle = WindowStyle.None;
    this.WindowState = WindowState.Maximized;
    isFullScreenModeEnabled = true; //Set Bool value to True
}
else if(isFullScreenModeEnabled)
{
//Set the current content to Grid
    this.Content = gridMediaPlayer;
//Now connect the Media Element with Grid.
    gridMediaPlayer.Children.Insert(0, mePlayerMain);
    mePlayerMain.Width = 780;         //My Media Element Width
    mePlayerMain.Height = 340;        //My Media Element Height
//Set The Window Style and State
    this.WindowStyle = WindowStyle.SingleBorderWindow;
    this.WindowState = WindowState.Normal;
    isFullScreenModeEnabled = false; //Set it False
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900