RadzenTree bound value not being highlighted


Radzen 3.14.1, .NET 5.0 Blazor Server

We are testing the Tree and Grid using the standard Blazor default project:
Index.razor - this get s replaced with Search.razor once a Tree item is selected.

We have the Tree in the NavMenu, and have wired up a scoped service to hold the selected item for the treeview. This works fine if we add a button to the NavMenu.razor and set the global bound-value of the Tree and the item is selected and highlighted just fine.

However, if we set the global value outside the NavMenu.razor, such as the Search.razor, the bound-value does get set, but it does not get highlighted.


public object TreeviewSelection { get; set; }

public void SetCurrentTreeviewItem(AllDrawingGroupTypesView x)
            TreeviewSelection = x;


        public event Action OnChange; // event raised when changed

        private void NotifyStateChanged() => OnChange?.Invoke();



The service is injected into all the .razor files listed above.

tree markup:

<RadzenTree @ref="allGroupsTree" Data="@AllGroupAndTypes" @bind-Value="@treeviewSelection.TreeviewSelection" Change="@OnTypeChange">
                    <RadzenTreeLevel TextProperty="WholeName" Expanded="@(data => false)" />

Furthermore, after we try to set it from the Search.razor, we can confirm the selected item in the Tree is correct, but the Change event does not get fired, and it is not highlighted.

You need to somehow trigger the layout to render. Using a global variable may not work as it lives in another component.