LinkUnlinkController.LinkAction Property
Provides access to the LinkUnlinkController‘s Link Action.
Namespace: DevExpress.ExpressApp.SystemModule
Assembly: DevExpress.ExpressApp.v24.1.dll
NuGet Package: DevExpress.ExpressApp
Declaration
Property Value
Type | Description |
---|---|
PopupWindowShowAction | A PopupWindowShowAction object representing the Link Action. |
Remarks
The Link Action adds the specified existing objects to a collection property displayed by a nested List View:
- ASP.NET Core Blazor
- Windows Forms
- ASP.NET Web Forms
To show all existing objects of the current collection property’s object type, a List View is created and shown in a pop-up Window. This List View is generated using information from the Application Model. The node which is used as the information source is determined by the LinkView property of the Views | <DetailView> | Items | <PropertyEditor> node defining the current collection property:
By default, the LinkView property is set to the value of the DefaultLookupListView property of the BOModel | <Class> node, defining the collection property’s object type. If the LinkView property is not specified, the ListView node used to display the collection property will be used.
To create a custom List View, handle the LinkUnlinkController.CustomCreateLinkView event.
You can filter the created List View by setting a criteria for the objects to be displayed. For this purpose, use the DataSourceCriteriaAttribute for the collection property. In addition, you can provide a custom collection source for the created List View. For this purpose, use the DataSourcePropertyAttribute. For details, refer to the How to: Filter a Link Dialog’s List View topic.
The created List View appears in a pop-up Window: the LookupForm
Template in Windows Forms, the Dialog.aspx page in ASP.NET Web Forms, and PopupWindowTemplate
in ASP.NET Core Blazor. To customize the pop-up Window’s Template, handle the PopupWindowShowAction.CustomizePopupWindowParams event that occurs after assigning the Template to the Window. Use the handler’s CustomizeTemplateEventArgs.Template parameter to access the Template. The LinkUnlinkController
handles this event to add the Search functionality to the Template, if required. This functionality is activated by default in Blazor applications, or when a created List View’s collection source contains more than 25 objects. This number is specified by the IModelOptions.LookupSmallCollectionItemCount property of the Application Model‘s Options node.
You can use other display modes for List View and the Search functionality in the Link Action’s pop-up Window. To select the mode, use the LookupEditorModeAttribute
for the collection property. Alternatively, you can use the Model Editor. The value of the LookupEditorMode
attribute’s mode parameter is set for the IModelCommonMemberViewItem.LookupEditorMode property of the BOModel | <Class> | OwnMembers | <Member> node, corresponding to the current collection property. For details, refer to How to: Add a Search Action to Lookup Property Editors and Link Pop-up Windows.
If you do not want to support the Search functionality, or need to modify it for a particular Link Action’s pop-up Window, inherit from the LinkUnlinkController and override the CustomizeLinkTemplate
method.
Note
The LookupEditorMode
, DataSourceCriteria
and DataSourceProperty
features are supported when the Link Action’s List View is created using information from a LookupListView node. This node is specified by the LinkView property of the DetailView | Items | PropertyEditor node that corresponds to the current collection property.
To add an Action to the Link Action’s pop-up Window, first determine what Action Containers can be included in the Window’s Template. For information on this, refer to the Add Actions to a Popup Window topic.
You can provide a custom list of the objects to be linked by the Link Action. For this purpose, handle the LinkUnlinkController.QueryLinkObjects event.
When implementing a custom Controller to modify the behavior of the LinkUnlinkController or its Link Action, you may have to determine whether the current List View is the one of the Link Action’s pop-up Windows. For this purpose, use one of the following criteria:
Use the List View’s ID:
Use the Template context of the List View’s Window:
The Link Action is active under the following conditions by default:
- If the current List View’s collection source is of the
PropertyCollectionSource
type, which is satisfied for List Views that display collection properties. - The current List View is not read-only.
- The applied Security System does not prohibit the current View’s access.
- The collection property represents the Many-to-Many relationship’s part; or it represents the One-to-Many relationship’s Many part, being non-aggregated.
To determine why the Link Action is deactivated or disabled, use the DiagnosticInfo Action. If you need to change the Action’s “active” or “enabled” state in code, use its ActionBase.Active or ActionBase.Enabled property.
Information on the Link Action is available in the Application Model‘s IModelActionDesign node. To access it, use the Model Editor.