概要:
那个键盘事件跟鼠标事件一个性质,就不写了,会用就行。今天学的这个TerryLee《一步一步学Silverlight 2系列(7):全屏模式支持》
这个还是很实用的。作为菜鸟,我觉得我现在能做到会用就行了,什么深度的扩展啊不是我现在能做的来的。
全屏模式:
我就直接贴代码了,再截个图说明我也试验成功了是不。作为菜鸟,咱们还得踏实的一步步来是不。。。


<
Canvas
Background
="#46461F"
>
< Button x:Name ="toggleButton" Background ="Red" Width ="200" Height ="80"
Canvas.Top ="80" Canvas.Left ="150" Content ="Toggle Full Screen"
FontSize ="20" Click ="toggleButton_Click" />
< Image x:Name ="image"
Canvas.Top ="100" Canvas.Left ="40" Source ="/SilverlightAppDemo7;component/Images/aspxba8205_20081025143826_2.jpg" ></ Image >
</ Canvas >
< Button x:Name ="toggleButton" Background ="Red" Width ="200" Height ="80"
Canvas.Top ="80" Canvas.Left ="150" Content ="Toggle Full Screen"
FontSize ="20" Click ="toggleButton_Click" />
< Image x:Name ="image"
Canvas.Top ="100" Canvas.Left ="40" Source ="/SilverlightAppDemo7;component/Images/aspxba8205_20081025143826_2.jpg" ></ Image >
</ Canvas >


using
System.Windows.Interop;
// 引用程序集
public MainPage()
{
InitializeComponent();
Application.Current.Host.Content.FullScreenChanged += new EventHandler(Content_FullScreenChanged);
}
private void toggleButton_Click( object sender, RoutedEventArgs e)
{
Content contentObject = Application.Current.Host.Content;
contentObject.IsFullScreen = ! contentObject.IsFullScreen;
}
private void Content_FullScreenChanged( object sender, EventArgs e)
{
Content contentObject = Application.Current.Host.Content;
if (contentObject.IsFullScreen)
{
toggleButton.Background = new SolidColorBrush(Colors.Green);
toggleButton.Content = " Full Screen Mode " ;
}
else
{
toggleButton.Background = new SolidColorBrush(Colors.Red);
toggleButton.Content = " Normal Mode " ;
}
}
// 引用程序集
public MainPage()
{
InitializeComponent();
Application.Current.Host.Content.FullScreenChanged += new EventHandler(Content_FullScreenChanged);
}
private void toggleButton_Click( object sender, RoutedEventArgs e)
{
Content contentObject = Application.Current.Host.Content;
contentObject.IsFullScreen = ! contentObject.IsFullScreen;
}
private void Content_FullScreenChanged( object sender, EventArgs e)
{
Content contentObject = Application.Current.Host.Content;
if (contentObject.IsFullScreen)
{
toggleButton.Background = new SolidColorBrush(Colors.Green);
toggleButton.Content = " Full Screen Mode " ;
}
else
{
toggleButton.Background = new SolidColorBrush(Colors.Red);
toggleButton.Content = " Normal Mode " ;
}
}

总目录
上一篇: vs2010 学习Silverlight学习笔记(5):事件响应
下一篇: vs2010 学习Silverlight学习笔记(7):控件样式与模板