UI Tookit UI Tookit
UI Tookit UI Tookit
DocFX + Singulink = ♥

Search Results for

    Property CanBeCached

    CanBeCached

    Gets a value indicating whether the view model and its associated view can be cached in the navigation stacks. Defaults to false, meaning a fresh view model and view are created every time the route is navigated to.

    Declaration
    bool CanBeCached { get; }
    Property Value
    Type Description
    bool
    Remarks

    Return true to keep the view model and view alive while they are inactive so that returning to them (e.g. by navigating back) is instant and preserves their state. A cached view model is navigated to again on the same instance, so OnNavigatedToAsync(NavigationArgs) must handle being called repeatedly (e.g. by skipping work that was already done and not subscribing to events twice). If a parent view model that provided services to a child view model is evicted from cache then all of its children are also evicted.

    Use ConfigureNavigationStacks(int, int, int) to control the maximum depth of cached views and view models.

    © Singulink. All rights reserved.