Wednesday, January 28, 2009

What Software Do I Use To Hack My Sidekick 09

WPF Window full screen

a WPF window can be displayed in full screen mode, and thus occupy the entire screen space without the Windows taskbar

How does it work?

Well, it's easier than you think. But there is no need to call native Windows APIs.

following XAML code shows how:


\u0026lt; Window x : Class = "WpfApplication1.Window1"


xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation"


xmlns: x = "http://schemas.microsoft.com / winfx/2006/xaml "


Title ="Window1"


WindowStyle ="None"


WindowState ="Maximized"


WindowStartupLocation ="CenterScreen">


< Grid Background ="Red">



</ Grid >

\u0026lt;/ Window >

First we the WindowState to Maximized specified. This course brings the window to fill the screen.

the whole screen? No, because down (or up) [or on the sides] is the Windows Taskbar.

is now the WindowStyle is set to None has no window frame, so no title bar and control bar.

disappears but now the taskbar and the window fills actually the entire screen out.

can now start as a photo show.


it is problematic when the user tries to close the window, because it lacks even the title bar with the Close or Minimize button. You should therefore still react to events the ESC or F11. These are used by default in full screen applications to return to normal window mode.



public partial class

Window1: Window

{



public Window1()

{

InitializeComponent();


this .KeyDown = RootKey;

}



void RootKey( object sender, KeyEventArgs e)

{


if ((e.Key == Key .Escape) (e.Key == Key .F11))

{


if ( this .WindowStyle == WindowStyle .None)

{


this .WindowStyle = WindowStyle .ThreeDBorderWindow;


this .WindowState = WindowState .Normal;

}


else

{


this .WindowStyle = WindowStyle .None;


this WindowState = Maximized WindowState;..

}


e.Handled = true ;


}


}

}


Whether this feature is intended, I do not know. Whether this feature requires every application? Probably not.

Anyone wanting to develop a full-screen application that can do this with WPF, with relatively little effort.