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
component
UiComponentBaseThe component which is searched.
Returns
- IReadOnlyCollection<TComponent>
All components that matches type
TComponent
.
Type Parameters
TComponent
The 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
component
UiComponentBaseThe component to get or add the tab under.
name
stringThe 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
component
UiComponentBaseThe component which is searched.
Returns
- TComponent
The first component that matches type
TComponent
.
Type Parameters
TComponent
The 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
component
UiComponentBaseThe component which is searched.
Returns
- bool
true
ifcomponent
or a child isTComponent
;false
otherwise.
Type Parameters
TComponent
The 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
component
UiComponentBaseThe component which is searched.
result
TComponentWhen the method returns, contains either the first
TComponent
component ornull
.
Returns
- bool
true
if a component of typeTComponent
was found;false
otherwise.
Type Parameters
TComponent
The type of the component to find.