本文整理汇总了C#中IParserContext.LookupNamespace方法的典型用法代码示例。如果您正苦于以下问题:C# IParserContext.LookupNamespace方法的具体用法?C# IParserContext.LookupNamespace怎么用?C# IParserContext.LookupNamespace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IParserContext
的用法示例。
在下文中一共展示了IParserContext.LookupNamespace方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FinishInitialization
public override void FinishInitialization(IParserContext context)
{
// if we have a type specified in the event name, we get the RoutedEvent here
string localName;
string namespaceUri;
context.LookupNamespace(Event, out localName, out namespaceUri);
var namespaceHandler = context.GetNamespaceHandler(namespaceUri);
if (namespaceHandler != null)
{
int n = localName.IndexOf('.');
if (n >= 0)
{
var sourceType = namespaceHandler.GetElementType(localName.Substring(0, n), true);
var eventName = localName.Substring(n + 1);
_routedEvent = EventManager.GetRoutedEventForOwner(sourceType, eventName, true);
}
// for events without explicit set type, the type and RoutedEvent is looked up in Set/Reset on the target object type.
}
base.FinishInitialization(context);
}
示例2: ParseType
/// <summary>
/// Given a string specifying a type, this method returns the type.
/// </summary>
/// <param name="context">The current document context.</param>
/// <param name="typeName">Type string in the form <c>sys:Int32</c>, where the prefix
/// is a prefix currently registered in the <paramref name="context"/>, and the suffix
/// is a type known by the namespace handler specified by the prefix.</param>
/// <returns>Type object for the specified type string.</returns>
public static Type ParseType(IParserContext context, string typeName)
{
string localName;
string namespaceURI;
context.LookupNamespace(typeName, out localName, out namespaceURI);
return context.GetNamespaceHandler(namespaceURI).GetElementType(localName);
}
示例3: ValueDataDescriptor
void IEvaluableMarkupExtension.Initialize(IParserContext context)
{
string localName;
string namespaceURI;
context.LookupNamespace(_typeName, out localName, out namespaceURI);
Type type = context.GetNamespaceHandler(namespaceURI).GetElementType(localName);
IDataDescriptor result;
try
{
if (PathExpression.Compile(context, _staticMemberName).Evaluate(
new ValueDataDescriptor(type), out result))
_value = result.Value;
}
catch (XamlBindingException e)
{
ServiceRegistration.Get<ILogger>().Warn("Error evaluating Static markup", e);
}
}