Class ListScreenInjector<TScreen, TScreenModel, TRowModel>
- Namespace
- Dynamicweb.CoreUI.Screens
- Assembly
- Dynamicweb.CoreUI.dll
Base class for injecting custom cells and actions into a ListScreenBase<TScreenModel, TRowModel>
without modifying the screen class itself.
Implementations are discovered automatically via AddInManager — no DI registration required.
public abstract class ListScreenInjector<TScreen, TScreenModel, TRowModel> : ScreenInjector<TScreen> where TScreen : ListScreenBase<TScreenModel, TRowModel> where TScreenModel : DataListViewModel<TRowModel> where TRowModel : DataViewModelBase
Type Parameters
TScreenThe list screen type to inject into.
TScreenModelThe screen-level view model (wraps the row collection).
TRowModelThe per-row view model type.
- Inheritance
-
ScreenInjector<TScreen>ListScreenInjector<TScreen, TScreenModel, TRowModel>
- Derived
-
ListScreenInjector<TScreen, TRowModel>
- Inherited Members
Remarks
Example — adding toolbar and row actions to a list screen from another assembly:
using System.Collections.Generic;
using Dynamicweb.CoreUI.Actions;
using Dynamicweb.CoreUI.Screens;
using Dynamicweb.Products.UI.Models;
using Dynamicweb.Products.UI.Screens;
public sealed class MyProductListScreenInjector : ListScreenInjector<ProductListScreen, ProductListModel, ProductDataModel>
{
// Adds a button to the screen toolbar.
public override IEnumerable<ActionGroup>? GetScreenActions()
{
return new[]
{
new ActionGroup { Nodes = [ new MyScreenAction() ] }
};
}
// Adds a context-menu item to every row.
public override IEnumerable<ActionGroup>? GetListItemActions(ProductDataModel model)
{
if (model is null)
return null;
return new[]
{
new ActionGroup { Nodes = [ new MyRowAction(model.Id) ] }
};
}
}
Use the two-parameter shorthand ListScreenInjector<TScreen, TRowModel> when the screen model is the standard DataListViewModel<T>.
Methods
GetCell(string, TRowModel)
Override to return a custom Cell for a column.
Return null to use the screen's default cell for that property.
public virtual Cell? GetCell(string propertyName, TRowModel model)
Parameters
propertyNamestringmodelTRowModel
Returns
GetListItemActions(TRowModel)
Override to add per-row action groups (context menu items, row buttons, etc.).
public virtual IEnumerable<ActionGroup>? GetListItemActions(TRowModel model)
Parameters
modelTRowModel
Returns
GetScreenActions()
Override to add screen-level action groups (toolbar buttons, etc.).
public virtual IEnumerable<ActionGroup>? GetScreenActions()