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); }
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); }
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); }
void IItemsControl.Apply(IItemElementFindStrategy itemElementFindStrategy) { ItemElementFindStrategy = itemElementFindStrategy; }