Silverlight捕获事件操作方法介绍

开发 开发工具
当我们在进行全屏模式和普通模式之间进行切换的时候,需要进行Silverlight捕获事件来获得功能的实现。大家可以通过本文介绍的内容提高对这款工具的认识。

Silverlight开发工具在实际使用中,有很多功能和使用技巧值得我们去深入的探讨,总结,以此来方便我们的开发程序效率。在这里就介绍一下有关Silverlight捕获事件的实现方法。#t#

有时候,我们需要在全屏模式和普通模式之间切换时,添加一个其它的代码,这时可以使用事件FullScreenChanged。

  1. public Page()  
  2. {  
  3. InitializeComponent();  
  4. Application.Current.Host.
    Content.FullScreenChanged +=
     new EventHandler(Content_
    FullScreenChanged);  

实现Silverlight捕获事件处理

private void Content_FullScreen
Changed(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";   }  
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.

在普通模式和全屏模式之间切换时,改变按钮的背景色和文字。

 

完整的Silverlight捕获事件代码如下:

 

public partial class Page :
 UserControl  
{   public Page()   {   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_FullScreen
Changed(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";   }   }  
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.

Silverlight捕获事件的相关实现方法就为大家介绍到这里。

责任编辑:曹凯 来源: 博客园
相关推荐

2009-12-30 15:53:28

Silverlight

2010-01-04 16:50:04

Silverlight

2009-12-31 11:35:20

Silverlight

2009-12-30 16:48:52

Silverlight

2009-12-28 17:48:01

WPF界面布局

2010-01-28 14:01:32

Android监听通话

2009-12-30 15:08:04

Silverlight

2009-12-31 16:38:19

Silverlight

2009-12-30 10:44:38

Silverlight

2010-01-07 10:46:27

VB.NET Sock

2010-01-06 17:12:26

.Net Framew

2010-02-01 09:40:08

Python操作

2009-12-15 13:59:42

Ruby对象操作

2011-07-20 15:08:22

C++

2009-12-31 16:18:44

Silverlight

2009-12-30 10:32:31

Silverlight

2009-12-30 14:44:04

Silverlight

2010-03-04 09:58:32

安装Python

2010-02-23 17:59:52

WSIT连接WCF

2010-03-05 13:48:24

Python for
点赞
收藏

51CTO技术栈公众号