Once i have mouseover to the window it will change to full screen windows and the video will also change to fullscreen but i have a error is that when i mouseover again i have it back to normal windows but my video is not back to normal video size as the normal window and still remain the fullscreen video size.
XAML code
C# Code
XAML code
<
Window
x:Class
=
"WpfApplication1.MainWindow"
Title
=
"MainWindow"
Height
=
"350"
Width
=
"525"
Loaded
=
"Window_Loaded"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
>
<
Grid
>
<
DockPanel
Name
=
"LayoutRoot"
/>
<
MediaElement
Canvas.Left
=
"20"
Canvas.Top
=
"40"
Name
=
"VideoControl"
LoadedBehavior
=
"Play"
UnloadedBehavior
=
"Stop"
/>
<
telerik:RadButton
telerik:StyleManager.Theme
=
"Transparent"
Content
=
"Close"
Height
=
"Auto"
HorizontalAlignment
=
"Left"
Margin
=
"26,199,0,0"
Name
=
"PlayButton"
VerticalAlignment
=
"Top"
Width
=
"Auto"
Click
=
"PlayButton_Click"
Visibility
=
"Visible"
/>
</
Grid
>
</
Window
>
C# Code
namespace
WpfApplication1
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public
partial
class
MainWindow : Window
{
public
MainWindow()
{
bool
fullscreen =
false
;
InitializeComponent();
VideoControl.Volume = 100;
VideoControl.MouseMove +=
delegate
{
//fullscreen mode
if
(!fullscreen)
{
//LayoutRoot.Children.Remove(VideoControl);
//this.Content = VideoControl;
this
.WindowStyle = WindowStyle.None;
this
.WindowState = WindowState.Maximized;
VideoControl.Width = 1850;
VideoControl.Height = 1850;
}
else
{
//non fullscreen mode
//this.Content = LayoutRoot;
//LayoutRoot.Children.Add(VideoControl);
this
.WindowStyle = WindowStyle.SingleBorderWindow;
this
.WindowState = WindowState.Normal;
VideoControl.Width = 1000;
VideoControl.Height = 1000;
}
fullscreen = !fullscreen;
};
}
private
void
Window_Loaded(
object
sender, RoutedEventArgs e)
{
VideoControl.Source =
new
Uri(
"C:\\Users\\Public\\Videos\\Sample Videos\\Wildlife.wmv"
);
}
private
void
PlayButton_Click(
object
sender, RoutedEventArgs e)
{
//VideoControl.Play();
Close();
}
}
}