本文整理汇总了C#中INameScope类的典型用法代码示例。如果您正苦于以下问题:C# INameScope类的具体用法?C# INameScope怎么用?C# INameScope使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
INameScope类属于命名空间,在下文中一共展示了INameScope类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: AddScopeElements
private void AddScopeElements(INameScope scope, ElementAccessor[] elements, ref bool duplicateElements, bool allowDuplicates)
{
for (int i = 0; i < elements.Length; i++)
{
this.AddScopeElement(scope, elements[i], ref duplicateElements, allowDuplicates);
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:XmlSchemaImporter.cs
示例2: Remove
public void Remove(FrameworkElement target, INameScope nameScope, object layerOwner)
{
if (Storyboard != null)
{
Storyboard.Remove(target, nameScope, layerOwner);
}
}
开发者ID:diab0l,项目名称:Granular,代码行数:7,代码来源:StoryboardAction.cs
示例3: Timer
public Timer(
NodeGCType gcType,
INodeScope parentNodeScope,
INameScope parentNameScope,
string initialBasicName
)
: base(gcType, parentNodeScope, parentNameScope, initialBasicName)
{
Debug.Assert(gcType == s_gcTypeOfAllInstances);
}
开发者ID:cerver,项目名称:GC_Timer-3,代码行数:10,代码来源:GCN_Timer.cs
示例4: InitializeContext
public InitializeContext(object target, InitializeContext parentContext, INameScope nameScope, FrameworkElement templatedParent, BaseValueSource valueSource)
{
this.Target = target;
this.ParentContext = parentContext;
this.NameScope = nameScope;
this.TemplatedParent = templatedParent;
this.ValueSource = valueSource;
this.Root = parentContext != null && parentContext.Root != null ? parentContext.Root : Target;
}
开发者ID:highzion,项目名称:Granular,代码行数:11,代码来源:InitializeContext.cs
示例5: AddUniqueAccessor
private static void AddUniqueAccessor(INameScope scope, Accessor accessor)
{
Accessor accessor2 = (Accessor) scope[accessor.Name, accessor.Namespace];
if (accessor2 != null)
{
if (accessor is ElementAccessor)
{
throw new InvalidOperationException(Res.GetString("XmlDuplicateElementName", new object[] { accessor2.Name, accessor2.Namespace }));
}
throw new InvalidOperationException(Res.GetString("XmlDuplicateAttributeName", new object[] { accessor2.Name, accessor2.Namespace }));
}
scope[accessor.Name, accessor.Namespace] = accessor;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:13,代码来源:XmlReflectionImporter.cs
示例6: Begin
public void Begin(FrameworkElement containingObject, INameScope nameScope = null, HandoffBehavior handoffBehavior = HandoffBehavior.SnapshotAndReplace, object layerOwner = null)
{
Stop(containingObject);
TimelineClock clock = CreateClock();
clock.Begin(((IAnimatable)containingObject).RootClock);
clocks[containingObject] = clock;
ListDictionary<TargetKey, AnimationTimelineClock> targets = GetAnimationClocksTargets(clock, containingObject, nameScope ?? NameScope.GetContainingNameScope(containingObject));
foreach (TargetKey target in targets.GetKeys())
{
target.Target.ApplyAnimationClocks(target.TargetProperty, targets.GetValues(target), handoffBehavior, layerOwner);
}
}
开发者ID:highzion,项目名称:Granular,代码行数:15,代码来源:Storyboard.cs
示例7: AddScopeElement
private void AddScopeElement(INameScope scope, ElementAccessor element, ref bool duplicateElements, bool allowDuplicates)
{
if (scope != null)
{
ElementAccessor accessor = (ElementAccessor) scope[element.Name, element.Namespace];
if (accessor != null)
{
if (!allowDuplicates)
{
throw new InvalidOperationException(Res.GetString("XmlDuplicateElementInScope", new object[] { element.Name, element.Namespace }));
}
if (accessor.Mapping.TypeDesc != element.Mapping.TypeDesc)
{
throw new InvalidOperationException(Res.GetString("XmlDuplicateElementInScope1", new object[] { element.Name, element.Namespace }));
}
duplicateElements = true;
}
else
{
scope[element.Name, element.Namespace] = element;
}
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:23,代码来源:XmlSchemaImporter.cs
示例8: WireRootObjectToParent
private static DependencyObject WireRootObjectToParent(object createdObject, DependencyObject rootObject, DependencyObject container, FrameworkElement feContainer, INameScope nameScope)
{
rootObject = createdObject as DependencyObject;
if (rootObject != null)
{
// Add the root to the appropriate tree.
if (feContainer != null)
{
// Put the root object into FE.Templatechild (must be a UIElement).
UIElement rootElement = rootObject as UIElement;
if (rootElement == null)
{
throw new InvalidOperationException(SR.Get(SRID.TemplateMustBeFE, new object[] { rootObject.GetType().FullName }));
}
feContainer.TemplateChild = rootElement;
Debug.Assert(!(rootElement is FrameworkElement) ||
((FrameworkElement)rootElement).TemplateChildIndex != -1);
}
// If we have a container that is not a FE, add to the logical tree of the FEF
else if (container != null)
{
FrameworkElement feResult;
FrameworkContentElement fceResult;
Helper.DowncastToFEorFCE(rootObject, out feResult, out fceResult, true);
FrameworkElementFactory.AddNodeToLogicalTree((FrameworkContentElement)container,
rootObject.GetType(), feResult != null, feResult, fceResult);
}
// Set the TemplateNameScope on the root
if (NameScope.GetNameScope(rootObject) == null)
{
NameScope.SetNameScope(rootObject, nameScope);
}
}
return rootObject;
}
开发者ID:mind0n,项目名称:hive,代码行数:38,代码来源:FrameworkTemplate.cs
示例9: HandleBeforeProperties
private void HandleBeforeProperties(object createdObject,
ref DependencyObject rootObject,
DependencyObject container,
FrameworkElement feContainer,
INameScope nameScope)
{
if (createdObject is FrameworkElement || createdObject is FrameworkContentElement)
{
// We want to set TemplateChild on the parent if we are dealing with the root
// We MUST wait until the object is wired into the Template vis TemplateNameScope.RegisterName
if (rootObject == null)
{
rootObject = WireRootObjectToParent(createdObject, rootObject, container, feContainer, nameScope);
}
InvalidatePropertiesOnTemplate(container, createdObject);
}
}
开发者ID:mind0n,项目名称:hive,代码行数:18,代码来源:FrameworkTemplate.cs
示例10: SetNameScope
/// <summary>
/// Sets the value of the attached <see cref="NameScopeProperty"/> on a visual.
/// </summary>
/// <param name="visual">The visual.</param>
/// <param name="value">The value to set.</param>
public static void SetNameScope(Visual visual, INameScope value)
{
visual.SetValue(NameScopeProperty, value);
}
开发者ID:furesoft,项目名称:Perspex,代码行数:9,代码来源:NameScope.cs
示例11: NameScope
public NameScope (INameScope external)
{
this.external = external;
}
开发者ID:bbqchickenrobot,项目名称:WPFLight,代码行数:4,代码来源:NameScope.cs
示例12: FindNameScope
/// <summary>
/// Returns the nearest element implementing <see cref="INameScope"/>, stepping up the
/// logical tree from our context object.
/// </summary>
/// <param name="result">Returns the nearest name scope element, if there is one.</param>
/// <returns><c>true</c>, if a name scope could be found, <c>false</c> if it could not
/// be found (yet).</returns>
protected bool FindNameScope(out INameScope result)
{
result = null;
DependencyObject current = _contextObject;
if (current == null)
{
#if DEBUG_BINDINGS
DebugOutput("FindNameScope doesn't have a current context");
#endif
return false;
}
while (current != null)
{
if (current is INameScope)
{
result = current as INameScope;
return true;
}
if (current is UIElement)
{
UIElement uiElement = (UIElement) current;
AbstractProperty templateNameScopeProperty = uiElement.TemplateNameScopeProperty;
AttachToSourcePathProperty(templateNameScopeProperty);
if ((result = ((INameScope) templateNameScopeProperty.GetValue())) != null)
return true;
}
if (!FindParent(current, out current, FindParentMode.HybridPreferLogicalTree))
return false;
}
return false;
}
开发者ID:joconno4,项目名称:MediaPortal-2,代码行数:38,代码来源:BindingMarkupExtension.cs
示例13: ResolveTargetName
/// <summary>
/// Finds the target element of a Storyboard.TargetName property.
/// </summary>
/// <remarks>
/// This is using a different set of FindName rules than that used
/// by ResolveBeginStoryboardName for finding a BeginStoryboard object due
/// to the different FindName behavior in templated objects.
///
/// The templated object name is the name attached to the
/// FrameworkElementFactory that created the object. There are many of them
/// created, one per templated object. So we need to use Template.FindName()
/// to find the templated child using the context of the templated parent.
///
/// Note that this FindName() function on the template class is
/// completely different from the INameScope.FindName() function on the
/// same class
/// </remarks>
internal static DependencyObject ResolveTargetName(
string targetName,
INameScope nameScope,
DependencyObject element )
{
object nameScopeUsed = null;
object namedObject = null;
DependencyObject targetObject = null;
FrameworkElement fe = element as FrameworkElement;
FrameworkContentElement fce = element as FrameworkContentElement;
if( fe != null )
{
if( nameScope != null )
{
namedObject = ((FrameworkTemplate)nameScope).FindName(targetName, fe);
nameScopeUsed = nameScope;
}
else
{
namedObject = fe.FindName(targetName);
nameScopeUsed = fe;
}
}
else if( fce != null )
{
Debug.Assert( nameScope == null );
namedObject = fce.FindName(targetName);
nameScopeUsed = fce;
}
else
{
throw new InvalidOperationException(
SR.Get(SRID.Storyboard_NoNameScope, targetName));
}
if( namedObject == null )
{
throw new InvalidOperationException(
SR.Get(SRID.Storyboard_NameNotFound, targetName, nameScopeUsed.GetType().ToString()));
}
targetObject = namedObject as DependencyObject;
if( targetObject == null )
{
throw new InvalidOperationException(SR.Get(SRID.Storyboard_TargetNameNotDependencyObject, targetName ));
}
return targetObject;
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:67,代码来源:Storyboard.cs
示例14: RegisterName
private void RegisterName(ObjectWriterContext ctx, string name, object inst, XamlType xamlType, INameScope nameScope, INameScope parentNameScope, bool isRoot)
{
INameScope objA = nameScope;
NameScopeDictionary dictionary = nameScope as NameScopeDictionary;
if (dictionary != null)
{
objA = dictionary.UnderlyingNameScope;
}
if (object.ReferenceEquals(objA, inst) && !isRoot)
{
nameScope = parentNameScope;
}
if (!(inst is NameFixupToken))
{
try
{
nameScope.RegisterName(name, inst);
}
catch (Exception exception)
{
if (CriticalExceptions.IsCriticalException(exception))
{
throw;
}
throw this.WithLineInfo(new XamlObjectWriterException(System.Xaml.SR.Get("NameScopeException", new object[] { exception.Message }), exception));
}
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:28,代码来源:XamlObjectWriter.cs
示例15: AddUniqueAccessor
static void AddUniqueAccessor(INameScope scope, Accessor accessor) {
Accessor existing = (Accessor)scope[accessor.Name, accessor.Namespace];
if (existing != null) {
if (accessor is ElementAccessor) {
throw new InvalidOperationException(Res.GetString(Res.XmlDuplicateElementName, existing.Name, existing.Namespace));
}
else {
#if DEBUG
if (!(accessor is AttributeAccessor))
throw new InvalidOperationException(Res.GetString(Res.XmlInternalErrorDetails, "Bad accessor type " + accessor.GetType().FullName));
#endif
throw new InvalidOperationException(Res.GetString(Res.XmlDuplicateAttributeName, existing.Name, existing.Namespace));
}
}
else {
scope[accessor.Name, accessor.Namespace] = accessor;
}
}
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:18,代码来源:xmlreflectionimporter.cs
示例16: Initialize
private void Initialize(XamlSchemaContext schemaContext, XamlSavedContext savedContext, XamlObjectWriterSettings settings)
{
this._inDispose = false;
if (schemaContext == null)
{
throw new ArgumentNullException("schemaContext");
}
if ((savedContext != null) && (schemaContext != savedContext.SchemaContext))
{
throw new ArgumentException(System.Xaml.SR.Get("SavedContextSchemaContextMismatch"), "schemaContext");
}
if (settings != null)
{
this._afterBeginInitHandler = settings.AfterBeginInitHandler;
this._beforePropertiesHandler = settings.BeforePropertiesHandler;
this._afterPropertiesHandler = settings.AfterPropertiesHandler;
this._afterEndInitHandler = settings.AfterEndInitHandler;
this._xamlSetValueHandler = settings.XamlSetValueHandler;
this._rootObjectInstance = settings.RootObjectInstance;
this._skipDuplicatePropertyCheck = settings.SkipDuplicatePropertyCheck;
this._skipProvideValueOnRoot = settings.SkipProvideValueOnRoot;
this._preferUnconvertedDictionaryKeys = settings.PreferUnconvertedDictionaryKeys;
}
INameScope rootNameScope = (settings != null) ? settings.ExternalNameScope : null;
XamlRuntime runtime = this.CreateRuntime(settings, schemaContext);
if (savedContext != null)
{
this._context = new ObjectWriterContext(savedContext, settings, rootNameScope, runtime);
}
else
{
if (schemaContext == null)
{
throw this.WithLineInfo(new XamlInternalException());
}
this._context = new ObjectWriterContext(schemaContext, settings, rootNameScope, runtime);
this._context.AddNamespacePrefix("xml", "http://www.w3.org/XML/1998/namespace");
}
this._context.IsInitializedCallback = this;
this._deferringWriter = new DeferringWriter(this._context);
this._rootNamescope = null;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:42,代码来源:XamlObjectWriter.cs
示例17: ApplyMediaClock
/// <summary>
/// When we've found a media clock, try to find a corresponding media
/// element and attach the media clock to that element.
/// </summary>
private static void ApplyMediaClock( INameScope nameScope, DependencyObject containingObject,
DependencyObject currentObject, string currentObjectName, MediaClock mediaClock )
{
MediaElement targetMediaElement = null;
if( currentObjectName != null )
{
// Find the object named as the current target name.
DependencyObject mentor = Helper.FindMentor(containingObject);
targetMediaElement = ResolveTargetName(currentObjectName, nameScope, mentor ) as MediaElement;
if( targetMediaElement == null )
{
throw new InvalidOperationException(SR.Get(SRID.Storyboard_MediaElementNotFound, currentObjectName ));
}
}
else if( currentObject != null )
{
targetMediaElement = currentObject as MediaElement;
}
else
{
targetMediaElement = containingObject as MediaElement;
}
if( targetMediaElement == null )
{
throw new InvalidOperationException(SR.Get(SRID.Storyboard_MediaElementRequired));
}
targetMediaElement.Clock = mediaClock;
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:36,代码来源:Storyboard.cs
示例18: ClockTreeWalkRecursive
/// <summary>
/// Recursively walks the clock tree and determine the target object
/// and property for each clock in the tree.
/// </summary>
/// <remarks>
/// The currently active object and property path are passed in as parameters,
/// they will be used unless a target/property specification exists on
/// the Timeline object corresponding to the current clock. (So that the
/// leaf-most reference wins.)
///
/// The active object and property parameters may be null if they have
/// never been specified. If we reach a leaf node clock and a needed attribute
/// is still null, it is an error condition. Otherwise we keep hoping they'll be found.
/// </remarks>
private void ClockTreeWalkRecursive(
Clock currentClock, /* No two calls will have the same currentClock */
DependencyObject containingObject, /* Remains the same through all the recursive calls */
INameScope nameScope, /* Remains the same through all the recursive calls */
DependencyObject parentObject,
string parentObjectName,
PropertyPath parentPropertyPath,
HandoffBehavior handoffBehavior, /* Remains the same through all the recursive calls */
HybridDictionary clockMappings,
Int64 layer /* Remains the same through all the recursive calls */)
{
Timeline currentTimeline = currentClock.Timeline;
DependencyObject targetObject = parentObject;
string currentObjectName = parentObjectName;
PropertyPath currentPropertyPath = parentPropertyPath;
// If we have target object/property information, use it instead of the
// parent's information.
string nameString = (string)currentTimeline.GetValue(TargetNameProperty);
if( nameString != null )
{
if( nameScope is Style )
{
// We are inside a Style - we don't let people target anything.
// They're only allowed to modify the Styled object, which is
// already the implicit target.
throw new InvalidOperationException(SR.Get(SRID.Storyboard_TargetNameNotAllowedInStyle, nameString));
}
currentObjectName = nameString;
}
// The TargetProperty trumps the TargetName property.
DependencyObject localTargetObject = (DependencyObject) currentTimeline.GetValue(TargetProperty);
if( localTargetObject != null )
{
targetObject = localTargetObject;
currentObjectName = null;
}
PropertyPath propertyPath = (PropertyPath)currentTimeline.GetValue(TargetPropertyProperty);
if( propertyPath != null )
{
currentPropertyPath = propertyPath;
}
// Now see if the current clock is an animation clock
if( currentClock is AnimationClock )
{
DependencyProperty targetProperty = null;
AnimationClock animationClock = (AnimationClock)currentClock;
if( targetObject == null )
{
// Resolve the target object name. If no name specified, use the
// containing object.
if( currentObjectName != null )
{
DependencyObject mentor = Helper.FindMentor(containingObject);
targetObject = ResolveTargetName(currentObjectName, nameScope, mentor);
}
else
{
// The containing object must be either an FE or FCE.
// (Not a Storyboard, as used for "shared clocks" mode.)
targetObject = containingObject as FrameworkElement;
if(targetObject == null)
{
targetObject = containingObject as FrameworkContentElement;
}
if( targetObject == null )
{
// The containing object is not an FE or FCE.
throw new InvalidOperationException(SR.Get(SRID.Storyboard_NoTarget, currentTimeline.GetType().ToString() ));
}
}
}
// See if we have a property name to use.
if( currentPropertyPath == null )
{
throw new InvalidOperationException(SR.Get(SRID.Storyboard_TargetPropertyRequired, currentTimeline.GetType().ToString() ));
}
//.........这里部分代码省略.........
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:101,代码来源:Storyboard.cs
示例19: ResolveBeginStoryboardName
/// <summary>
/// Finds a BeginStoryboard with the given name, following the rules
/// governing Storyboard. Returns null if not found.
/// </summary>
/// <remarks>
/// If a name scope is given, look there and nowhere else. In the
/// absense of name scope, use Framework(Content)Element.FindName which
/// has its own complex set of rules for looking up name scopes.
///
/// This is a different set of rules than from that used to look up
/// the TargetName. BeginStoryboard name is registered with the template
/// INameScope on a per-template basis. So we look it up using
/// INameScope.FindName(). This is a function completely different from
/// Template.FindName().
/// </remarks>
internal static BeginStoryboard ResolveBeginStoryboardName(
string targetName,
INameScope nameScope,
FrameworkElement fe,
FrameworkContentElement fce)
{
object namedObject = null;
BeginStoryboard beginStoryboard = null;
if( nameScope != null )
{
namedObject = nameScope.FindName(targetName);
if( namedObject == null )
{
throw new InvalidOperationException(
SR.Get(SRID.Storyboard_NameNotFound, targetName, nameScope.GetType().ToString()));
}
}
else if( fe != null )
{
namedObject = fe.FindName(targetName);
if( namedObject == null )
{
throw new InvalidOperationException(
SR.Get(SRID.Storyboard_NameNotFound, targetName, fe.GetType().ToString()));
}
}
else if( fce != null )
{
namedObject = fce.FindName(targetName);
if( namedObject == null )
{
throw new InvalidOperationException(
SR.Get(SRID.Storyboard_NameNotFound, targetName, fce.GetType().ToString()));
}
}
else
{
throw new InvalidOperationException(
SR.Get(SRID.Storyboard_NoNameScope, targetName));
}
beginStoryboard = namedObject as BeginStoryboard;
if( beginStoryboard == null )
{
throw new InvalidOperationException(SR.Get(SRID.Storyboard_BeginStoryboardNameNotFound, targetName));
}
return beginStoryboard;
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:66,代码来源:Storyboard.cs
示例20: OnTemplateApplied
/// <summary>
/// Called when the control's template is applied.
/// </summary>
/// <param name="nameScope">The template name scope.</param>
protected virtual void OnTemplateApplied(INameScope nameScope)
{
}
开发者ID:Sergey-Terekhin,项目名称:Perspex,代码行数:7,代码来源:TemplatedControl.cs
注:本文中的INameScope类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论