Table of Contents

Class PrefabLinkAttribute

Namespace
Bannerlord.UIExtenderEx.Attributes
Assembly
Bannerlord.UIExtenderEx.dll

Links a prefab patch or standalone mod prefab to its bound ViewModel type and, optionally, to the specific mixin type whose members it binds.

Consumed by Bannerlord.UIExtenderEx.Analyzers at build time to perform compile-time type checking, data-binding validation, and diagnostics across XML prefabs, ViewModels, and mixins. Ignored by UIExtenderEx at runtime.

For prefab patches, ViewModel corresponds to the active data source scope at the target injection node. For standalone prefabs, it corresponds to the root data source scope. If specified, Mixin must target the host ViewModel type or a base type when handleDerived: true is configured.

[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
public sealed class PrefabLinkAttribute : Attribute
Inheritance
PrefabLinkAttribute
Inherited Members

Examples

[assembly: PrefabLink(typeof(OptionsPagePatch), typeof(OptionsVM), typeof(OptionsVMMixin))]
[assembly: PrefabLink("ModOptionsView_MCM", typeof(ModOptionsVM))]

Constructors

PrefabLinkAttribute(string, Type)

Links a standalone mod prefab to the ViewModel at its root data source scope.

public PrefabLinkAttribute(string prefab, Type viewModel)

Parameters

prefab string

The prefab registration name or XML file name without extension.

viewModel Type

The ViewModel type bound at the prefab root.

PrefabLinkAttribute(string, Type, Type)

Links a standalone mod prefab to the ViewModel and mixin at its root data source scope.

public PrefabLinkAttribute(string prefab, Type viewModel, Type mixin)

Parameters

prefab string

The prefab registration name or XML file name without extension.

viewModel Type

The ViewModel type bound at the prefab root.

mixin Type

The mixin type whose members the prefab binds.

PrefabLinkAttribute(Type, Type)

Links a prefab patch to the ViewModel resolved at its target injection node.

public PrefabLinkAttribute(Type patch, Type viewModel)

Parameters

patch Type

The prefab patch class.

viewModel Type

The ViewModel type bound at the injection node.

PrefabLinkAttribute(Type, Type, Type)

Links a prefab patch to the ViewModel and mixin resolved at its target injection node.

public PrefabLinkAttribute(Type patch, Type viewModel, Type mixin)

Parameters

patch Type

The prefab patch class.

viewModel Type

The ViewModel type bound at the injection node.

mixin Type

The mixin type whose members the patch binds.

Properties

Mixin

Gets the optional mixin type whose members are exposed to the prefab XML.

public Type? Mixin { get; }

Property Value

Type

Patch

Gets the prefab patch type marked with PrefabExtensionAttribute, or null when linking a standalone prefab.

public Type? Patch { get; }

Property Value

Type

Prefab

Gets the standalone prefab name (either registered name or file name without extension), or null when linking a patch.

public string? Prefab { get; }

Property Value

string

ViewModel

Gets the target ViewModel type bound by the prefab XML at the injection point or root.

public Type ViewModel { get; }

Property Value

Type

This page was last modified at 10/05/2026 13:34:58 +03:00 (UTC).

Commit Message
Author:    Vitalii Mikhailov
Commit:    f3b725a97c3f299c20e56b5f206e27142ec15edd
* Added C# Auto-Generated XML prefab compilation for patched and dynamic movies, matching vanilla UI performance

* Added name-based property binding fallback for ViewModel subtypes not declared on the parent
* Improved unparseable prefab error logging with name and file details
* Fixed game crash with 3-segment attribute paths
* Added Bannerlord.UIExtenderE...