Need Automatic Rerendering of DxTabs in Blazor Application Using DevExpress Components

51 Views Asked by At

I'm facing an issue with rerendering dxTabs in my Blazor application using DevExpress components. Here's the scenario: I've set up a tabbed interface using the dxTabs component, and I require the tabs to rerender automatically whenever a specific state changes in my application. Specifically, I want the tabs to rerender whenever the state represented by the AppState.SelectedPlace property changes.

Here's how I've defined the **AppState **class to manage the **SelectedPlace **state:

public class AppState
{
    public Place SelectedPlace { get; private set; } = new Place
    {
        Name = "Tessttttt"
    };

    public event Action? OnChange;

    public void SetSelectedPlace(Place place)
    {
        SelectedPlace = place;
        OnChange?.Invoke();
    }
}

In my parent razor page, I have the following markup:

@AppState.SelectedPlace.Name
@* ---- Section: Tabs ---- *@
<DxTabs RenderMode="TabsRenderMode.Default">
    <DxTabPage @key="MyKey" Text="Osnovne nastavitve">
        <TabBasicSettings />
    </DxTabPage>
    <DxTabPage Text="IPoint">
        <TabIPoint />
    </DxTabPage>
    <DxTabPage Text="Dodatno">
        <TabAdditional />
    </DxTabPage>
</DxTabs>
@* ---- Section: Places Tree View ---- *@
<PlacesTreeView />

While the @AppState.SelectedPlace.Name rerenders successfully, the same property isn't being rerendered in the tabs group. Rerendering only occurs if I first change the @AppState.SelectedPlace state within by clicking on another node and then navigate to another tab, and finally come back to the first one.

I'm seeking a solution to trigger the rerendering of the tabs whenever the state property changes without the need for the described workaround.

0

There are 0 best solutions below