Ejemplo n.º 1
0
        private static void InitComponentLocator(UIComponent component, UIComponentMetadata metadata, FindAttribute findAttribute)
        {
            ComponentScopeLocateOptions   locateOptions = CreateScopeLocateOptions(metadata, findAttribute);
            IComponentScopeLocateStrategy strategy      = findAttribute.CreateStrategy(metadata);

            component.ScopeSource = findAttribute.ScopeSource;

            if (component is IItemsControl itemsControl)
            {
                IFindItemAttribute       findItemAttribute       = GetPropertyFindItemAttribute(metadata);
                IItemElementFindStrategy itemElementFindStrategy = findItemAttribute.CreateStrategy(component, metadata);
                itemsControl.Apply(itemElementFindStrategy);
            }

            component.ScopeLocator = new StrategyScopeLocator(component, strategy, locateOptions);
        }
Ejemplo n.º 2
0
        private static void InitComponentLocator(UIComponent component, UIComponentMetadata metadata)
        {
            // TODO: Remove this condition when IItemsControl will be removed.
#pragma warning disable CS0618
            if (component is IItemsControl itemsControl)
#pragma warning restore CS0618
            {
                IFindItemAttribute       findItemAttribute       = GetPropertyFindItemAttribute(metadata);
                IItemElementFindStrategy itemElementFindStrategy = findItemAttribute.CreateStrategy(component, metadata);
                itemsControl.Apply(itemElementFindStrategy);
            }

            component.ScopeLocator = new StrategyScopeLocator(
                new StrategyScopeLocatorExecutionDataCollector(component),
                StrategyScopeLocatorExecutor.Default);
        }
Ejemplo n.º 3
0
        private static void InitComponentLocator(UIComponent component, UIComponentMetadata metadata, FindAttribute findAttribute)
        {
            ComponentScopeLocateOptions   locateOptions = CreateScopeLocateOptions(metadata, findAttribute);
            IComponentScopeLocateStrategy strategy      = findAttribute.CreateStrategy(metadata);

            component.ScopeSource = findAttribute.ScopeSource;

            // TODO: Remove this condition when IItemsControl will be removed.
#pragma warning disable CS0618
            if (component is IItemsControl itemsControl)
#pragma warning restore CS0618
            {
                IFindItemAttribute       findItemAttribute       = GetPropertyFindItemAttribute(metadata);
                IItemElementFindStrategy itemElementFindStrategy = findItemAttribute.CreateStrategy(component, metadata);
                itemsControl.Apply(itemElementFindStrategy);
            }

            component.ScopeLocator = new StrategyScopeLocator(component, strategy, locateOptions);
        }