stride3d/stride · error · NotSupportedException
Can't change the name of a UIPage object.
Error message
Can't change the name of a UIPage object.
What it means
The Name setter of UIPageRootViewModel always throws NotSupportedException: the root of a UI page asset is a fixed pseudo-node labeled 'UI Page' whose display name cannot be changed through the view model.
Solutions
- Rename the UIPage asset itself rather than the root view model's Name.
- Treat the page root's Name as read-only in the UI (disable rename for the root node).
- Exclude root nodes from rename operations.
Example fix
// before pageRootViewModel.Name = "MyPage"; // after pageRootViewModel.Asset.Asset.Name = "MyPage"; // rename the asset, not the root node
Defensive patterns
Strategy: type-guard
Validate before calling
bool canRename = !(node is UIPageRootViewModel);
Type guard
static bool IsRenamable(IAssetNodeViewModel node) => !(node is UIPageRootViewModel);
Try / catch
try { node.Name = newName; } catch (NotSupportedException ex) { /* rename the asset instead */ } Prevention
- Disable rename UI for the page root node.
- Rename the UIPage asset itself.
- Exclude root view models from bulk rename operations.
When it happens
Trigger: Assigning to Name on the UIPage root view model, e.g. a TwoWay name binding in a property grid or calling the tree rename command on the page root.
Common situations: Generic rename UI applied to all hierarchy nodes; scripted bulk renaming that includes root nodes; expecting the root's Name to mirror the asset name.
Related errors
- Can't change the name of a UILibrary object.
- The given source panel does not match the currently set…
- A UIPage asset can't have more than one root.
- Custom strides is not supported with packed PixelFormats
- Unable to find the base
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/a4b4f4aa514d6a39.
Report an issue: GitHub.
Appendix: source
Thrown at sources/editor/Stride.Assets.Presentation/AssetEditors/UIPageEditor/ViewModels/UIPageRootViewModel.cs:33
namespace Stride.Assets.Presentation.AssetEditors.UIPageEditor.ViewModels
{
public sealed class UIPageRootViewModel : UIRootViewModel, IAddChildViewModel
{
/// <summary>
/// A UIPage asset cannot have more than one root.
/// </summary>
internal static readonly string OneRootOnly = "A UIPage asset can't have more than one root.";
public UIPageRootViewModel([NotNull] UIEditorBaseViewModel editor, [NotNull] UIPageViewModel asset, UIElementDesign rootElement)
: base(editor, asset, rootElement?.Yield())
{
NotifyGameSidePartAdded().Forget();
}
/// <inheritdoc />
[NotNull]
public override string Name { get => "UI Page"; set => throw new NotSupportedException("Can't change the name of a UIPage object."); }
[CanBeNull]
public UIElementViewModel RootElement => RootElements.SingleOrDefault();
/// <inheritdoc />
public override void ReplaceRootElement(PanelViewModel sourcePanel, AssetCompositeHierarchyData<UIElementDesign, UIElement> hierarchy, Guid targetPanelId)
{
if (sourcePanel == null) throw new ArgumentNullException(nameof(sourcePanel));
if (sourcePanel.Id.ObjectId != Asset.Asset.Hierarchy.RootParts.Single().Id)
throw new ArgumentException(@"The given source panel does not match the currently set root element", nameof(sourcePanel));
Asset.AssetHierarchyPropertyGraph.RemovePartFromAsset(sourcePanel.UIElementDesign);
Asset.AssetHierarchyPropertyGraph.AddPartToAsset(hierarchy.Parts, hierarchy.Parts[targetPanelId], null, Asset.Asset.Hierarchy.RootParts.Count);
}
/// <inheritdoc />
// ReSharper disable once RedundantAssignment
protected override bool CanAddOrInsertChildren(IReadOnlyCollection<object> children, ref string message)View on GitHub (pinned to 96fad776d2)