本文整理汇总了C#中IParserContext.GetContextVariable方法的典型用法代码示例。如果您正苦于以下问题:C# IParserContext.GetContextVariable方法的具体用法?C# IParserContext.GetContextVariable怎么用?C# IParserContext.GetContextVariable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IParserContext
的用法示例。
在下文中一共展示了IParserContext.GetContextVariable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: XamlBindingException
void IEvaluableMarkupExtension.Initialize(IParserContext context)
{
if (Id == null)
throw new XamlBindingException("GetModelMarkupExtension: Property Id has to be given");
IModelLoader loader = context.GetContextVariable(typeof(IModelLoader)) as IModelLoader;
if (loader == null)
throw new XamlBindingException("GetModelMarkupExtension: No model loader instance present in parser context");
_model = loader.GetOrLoadModel(new Guid(Id));
}
示例2: FinishInitialization
public void FinishInitialization(IParserContext context)
{
ISkinResourceBundle resourceBundle;
string includeFilePath = SkinContext.SkinResources.GetResourceFilePath(_includeName, true, out resourceBundle);
if (includeFilePath == null)
throw new XamlLoadException("Include: Could not open include file '{0}' (evaluated path is '{1}')", _includeName, includeFilePath);
_content = XamlLoader.Load(includeFilePath, resourceBundle, (IModelLoader) context.GetContextVariable(typeof(IModelLoader)));
if (_content is UIElement)
{
UIElement target = (UIElement) _content;
// Merge resources with those from the included content
target.Resources.TakeOver(_resources, true, true);
_resources = null;
}
else if (_content is ResourceDictionary)
{
((ResourceDictionary) _content).TakeOver(_resources, true, true);
_resources = null;
}
}