コード例 #1
0
 public DefaultAttachedPropertyDataDescriptor(INamespaceHandler namespaceHandler, object targetObject,
     string propertyProvider, string propertyName) : base(targetObject, propertyName,
     namespaceHandler.GetAttachedProperty(propertyProvider, propertyName, targetObject))
 {
   _namespaceHandler = namespaceHandler;
   _propertyProvider = propertyProvider;
 }
コード例 #2
0
 public DefaultAttachedPropertyDataDescriptor(INamespaceHandler namespaceHandler, object targetObject,
                                              string propertyProvider, string propertyName) : base(targetObject, propertyName,
                                                                                                   namespaceHandler.GetAttachedProperty(propertyProvider, propertyName, targetObject))
 {
     _namespaceHandler = namespaceHandler;
     _propertyProvider = propertyProvider;
 }
コード例 #3
0
        /// <summary>
        /// Creates a new <see cref="ElementContextInfo"/> structure for the specified
        /// string in attribute value instantiation syntax and pushes it on top of the
        /// stack of element context infos.
        /// </summary>
        /// <param name="currentInstantiationExpression">The instantiation expression for the
        /// new element to push.</param>
        /// <returns>The created element's context info instance.</returns>
        public ElementContextInfo PushElementContext(string currentInstantiationExpression)
        { // This code is almost the same as PushElementContext(XmlElement)
          // Clear cache
            _currentNamespaceHandler = null;
            // Create new stack entry
            ElementContextInfo result = new ElementContextInfo(currentInstantiationExpression);

            _contextStack.Push(result);
            return(result);
        }
コード例 #4
0
 public static bool CreateAttachedPropertyDataDescriptor(INamespaceHandler namespaceHandler, object targetObj,
     string propertyProvider, string propertyName, out DefaultAttachedPropertyDataDescriptor result)
 {
   result = null;
   if (targetObj == null)
     throw new NullReferenceException("Target object 'null' is not supported");
   if (!namespaceHandler.HasAttachedProperty(propertyProvider, propertyName, targetObj))
     return false;
   result = new DefaultAttachedPropertyDataDescriptor(namespaceHandler, targetObj, propertyProvider, propertyName);
   return true;
 }
コード例 #5
0
 /// <summary>
 /// Pops the current <see cref="ElementContextInfo"/> from the context element
 /// stack.
 /// </summary>
 public void PopElementContext()
 {
     // Clear cache
     _currentNamespaceHandler = null;
     // Remove all namespace definitions corresponding to the current element's context
     for (int i = CurrentElementContext.NamespaceCount; i > 0; i--)
     {
         _namespaceStack.Pop();
     }
     // Remove element's context itself
     _contextStack.Pop();
 }
コード例 #6
0
 public static bool CreateAttachedPropertyDataDescriptor(INamespaceHandler namespaceHandler, object targetObj,
                                                         string propertyProvider, string propertyName, out DefaultAttachedPropertyDataDescriptor result)
 {
     result = null;
     if (targetObj == null)
     {
         throw new NullReferenceException("Target object 'null' is not supported");
     }
     if (!namespaceHandler.HasAttachedProperty(propertyProvider, propertyName, targetObj))
     {
         return(false);
     }
     result = new DefaultAttachedPropertyDataDescriptor(namespaceHandler, targetObj, propertyProvider, propertyName);
     return(true);
 }
コード例 #7
0
 public AttachedPropertyPathSegment(IParserContext context, string propertyProvider, string propertyName,
                                    string namespaceURI)
 {
     if (string.IsNullOrEmpty(propertyProvider))
     {
         throw new XamlParserException("Property provider name must not be empty");
     }
     if (string.IsNullOrEmpty(propertyName))
     {
         throw new XamlParserException("Property name must not be empty");
     }
     _propertyProvider = propertyProvider;
     _propertyName     = propertyName;
     _namespaceURI     = namespaceURI;
     _namespaceHandler = context.GetNamespaceHandler(namespaceURI);
 }
コード例 #8
0
 /// <summary>
 /// Registers a local namespace handler for the specified
 /// <paramref name="namespaceURI"/>, which was declared in the XAML
 /// element corresponding to the current <see cref="ElementContextInfo"/>.
 /// </summary>
 /// <param name="namespaceURI">Namespace URI to be used as key for the
 /// <paramref name="handler"/>.</param>
 /// <param name="handler">Namespace handler object for the namespace.</param>
 public void RegisterNamespaceHandler(string namespaceURI, INamespaceHandler handler)
 {
     _contextStack.Peek().NamespaceCount++;
     _namespaceStack.Push(new KeyValuePair <string, INamespaceHandler>(namespaceURI, handler));
 }
コード例 #9
0
ファイル: Parser.cs プロジェクト: davinx/MediaPortal-2
 /// <summary>
 /// Gets a routed event from a qualified event name like 'UIElement.MouseDown'.
 /// </summary>
 /// <param name="namespaceHandler">Namespace handler for eventProvider.</param>
 /// <param name="eventProvider">Name of event provider type.</param>
 /// <param name="eventName">Event name.</param>
 /// <returns>Returns the routed event or <c>null</c> if <see cref="eventProvider"/> has no event with this name.</returns>
 private RoutedEvent GetQualifiedEvent(INamespaceHandler namespaceHandler,
     string eventProvider, string eventName)
 {
   Type type = namespaceHandler.GetElementType(eventProvider, true);
   if (type != null)
   {
     foreach (var routedEvent in EventManager.GetRoutedEventsForOwner(type))
     {
       if (routedEvent.Name.Equals(eventName))
       {
         return routedEvent;
       }
     }
   }
   return null;
 }