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

📄 uielementactivationstrategy.cs

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

namespace Microsoft.Practices.CompositeUI.Windows.Activation
{
	public class UIElementActivationStrategy : BuilderStrategy
	{
		public override object BuildUp(IBuilderContext context, Type typeToBuild, object existing, string idToBuild)
		{
			UIElement uiElement = existing as UIElement;

			if (uiElement != null)
			{
				WorkItem workItem = context.Locator.Get<WorkItem>(new DependencyResolutionLocatorKey(typeof(WorkItem), null));
				workItem.Services.Get<IUIElementActivationService>(true).UIElementAdded(uiElement);
			}

			return base.BuildUp(context, typeToBuild, existing, idToBuild);
		}

		public override object TearDown(IBuilderContext context, object item)
		{
			UIElement uiElement = item as UIElement;

			if (uiElement != null)
			{
				WorkItem workItem = context.Locator.Get<WorkItem>(new DependencyResolutionLocatorKey(typeof(WorkItem), null));
				workItem.Services.Get<IUIElementActivationService>(true).UIElementRemoved(uiElement );
			}

			return base.TearDown(context, item);
		}
	}
}

⌨️ 快捷键说明

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