⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frameworkelementcommandadapter.cs

📁 wpf和cab的结合使用源码(转载)
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using Microsoft.Practices.CompositeUI.Utility;
using Microsoft.Practices.CompositeUI.Commands;

namespace Microsoft.Practices.CompositeUI.Windows
{
	/// <summary>
	/// Adapts between a WPF <see cref="FrameworkElement"/> and a CAB <see cref="Command"/>.
	/// </summary>
	public class FrameworkElementCommandAdapter : EventCommandAdapter<FrameworkElement>
	{
		public FrameworkElementCommandAdapter() 
			: base()
		{
		}

		public FrameworkElementCommandAdapter(FrameworkElement item, string eventName)
			: base(item, eventName)
		{
		}

		protected override void OnCommandChanged(Command command)
		{
			base.OnCommandChanged(command);

			foreach (FrameworkElement key in Invokers.Keys)
			{
				key.IsEnabled = (command.Status == CommandStatus.Enabled);
				key.Visibility = (command.Status == CommandStatus.Unavailable) ? Visibility.Collapsed : Visibility.Visible;
			}
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -