新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
Silverlight捕獲事件操作方法介紹
Silverlight開發(fā)工具在實際使用中,有很多功能和使用技巧值得我們?nèi)ド钊氲奶接?,總結(jié),以此來方便我們的開發(fā)程序效率。在這里就介紹一下有關(guān)Silverlight捕獲事件的實現(xiàn)方法。#t#

有時候,我們需要在全屏模式和普通模式之間切換時,添加一個其它的代碼,這時可以使用事件FullScreenChanged。
- public Page()
- {
- InitializeComponent();
- Application.Current.Host.
Content.FullScreenChanged +=
new EventHandler(Content_
FullScreenChanged); - }
實現(xiàn)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";- }
- }
在普通模式和全屏模式之間切換時,改變按鈕的背景色和文字。
完整的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";- }
- }
- }
Silverlight捕獲事件的相關(guān)實現(xiàn)方法就為大家介紹到這里。
當前名稱:Silverlight捕獲事件操作方法介紹
文章路徑:http://m.fisionsoft.com.cn/article/dposioc.html


咨詢
建站咨詢
