Class ComponentExtensions
- Namespace
- Dynamicweb.CoreUI
- Assembly
- Dynamicweb.CoreUI.dll
Extensions for UiComponentBase.
public static class ComponentExtensions
- Inheritance
-
ComponentExtensions
- Inherited Members
Methods
GetAll<TComponent>(UiComponentBase)
Searches the given component or its child components and returns all components of type TComponent.
public static IReadOnlyCollection<TComponent> GetAll<TComponent>(this UiComponentBase component) where TComponent : UiComponentBase
Parameters
componentUiComponentBaseThe component which is searched.
Returns
- IReadOnlyCollection<TComponent>
All components that matches type
TComponent.
Type Parameters
TComponentThe type of the components to find.
GetOrAddTab(UiComponentBase, string)
Gets or adds a tab with the given name if the given component wraps a TabContainer.
public static Tab? GetOrAddTab(this UiComponentBase component, string name)
Parameters
componentUiComponentBaseThe component to get or add the tab under.
namestringThe name of the tab to get or add.
Returns
Get<TComponent>(UiComponentBase)
Searches the given component and its child components and returns the first component of type TComponent.
public static TComponent? Get<TComponent>(this UiComponentBase component) where TComponent : UiComponentBase
Parameters
componentUiComponentBaseThe component which is searched.
Returns
- TComponent
The first component that matches type
TComponent.
Type Parameters
TComponentThe type of the component to find.
Get<TComponent>(UiComponentBase, Func<TComponent, bool>)
Searches the given component and its child components and returns the first component of type TComponent matching the given predicate.
public static TComponent? Get<TComponent>(this UiComponentBase component, Func<TComponent, bool> predicate) where TComponent : UiComponentBase
Parameters
componentUiComponentBaseThe component which is searched.
predicateFunc<TComponent, bool>The predicate to find the specific component.
Returns
- TComponent
The first component that matches type
TComponent.
Type Parameters
TComponentThe type of the component to find.
Has<TComponent>(UiComponentBase)
Determines whether the given component or one of its child components is of type TComponent.
public static bool Has<TComponent>(this UiComponentBase component) where TComponent : UiComponentBase
Parameters
componentUiComponentBaseThe component which is searched.
Returns
- bool
trueifcomponentor a child isTComponent;falseotherwise.
Type Parameters
TComponentThe type of the component to find.
TryGet<TComponent>(UiComponentBase, out TComponent?)
Searches the given component or its child components and returns the first component of type TComponent.
public static bool TryGet<TComponent>(this UiComponentBase component, out TComponent? result) where TComponent : UiComponentBase
Parameters
componentUiComponentBaseThe component which is searched.
resultTComponentWhen the method returns, contains either the first
TComponentcomponent ornull.
Returns
- bool
trueif a component of typeTComponentwas found;falseotherwise.
Type Parameters
TComponentThe type of the component to find.