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
prefabstringThe prefab registration name or XML file name without extension.
viewModelTypeThe 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
prefabstringThe prefab registration name or XML file name without extension.
viewModelTypeThe ViewModel type bound at the prefab root.
mixinTypeThe 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
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
patchTypeThe prefab patch class.
viewModelTypeThe ViewModel type bound at the injection node.
mixinTypeThe 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
Patch
Gets the prefab patch type marked with PrefabExtensionAttribute, or null when linking a standalone prefab.
public Type? Patch { get; }
Property Value
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
ViewModel
Gets the target ViewModel type bound by the prefab XML at the injection point or root.
public Type ViewModel { get; }
Property Value
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...