Skip to content

Is OnDeactivate only called when explicit call Conductor.DeactivateItem? #258

Answered by canton7
GF-Huang asked this question in Q&A
Discussion options

You must be logged in to vote

The Conductor classes all have special logic to activate and deactivate their children when appropriate. If you're not using this, you'll have to write that logic yourself.

One thing you might be able to do is:

public class ParentViewModel : Conductor.Collections.OneActive<IScreen>
{
    public AViewModel A { get; }
    public BViewModel B { get; }

    public ParentViewModel()
    {
        A = ...
        B = ...

        this.Items.AddRange(A, B);
    }
}
<TabControl SelectedItem="{Binding ActiveItem}" .....
    <TabItem><ContentControl s:View.Model="{Binding A"}/></TabItem>
    <TabItem><ContentControl s:View.Model="{Binding B"}/></TabItem>
</TabControl>

(Untested).

So, your ViewModel…

Replies: 1 comment 10 replies

Comment options

You must be logged in to vote
10 replies
@canton7
Comment options

@GF-Huang
Comment options

@canton7
Comment options

@GF-Huang
Comment options

@GF-Huang
Comment options

Answer selected by GF-Huang
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants