canton7 / Stylet

A very lightweight but powerful ViewModel-First MVVM framework for WPF for .NET Framework and .NET Core, inspired by Caliburn.Micro.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OnInitialActivate Invalid

wf-soft opened this issue · comments

In the following case, screen is not the main window, but through the injected conductor, oninitialactivate will not be triggered

`
public class MainViewModel : Screen
{
[Inject]
public Test2ViewModel Test2VM { get; set; }
}

public class Test2ViewModel : Conductor.Collection.OneActive
{
protected override void OnViewLoaded()
{
base.OnViewLoaded();
Items.Add(Helper.Ioc.Get());
Items.Add(Helper.Ioc.Get());
Items.Add(Helper.Ioc.Get());
Items[0].DisplayName = "0";
Items[1].DisplayName = "1";
Items[2].DisplayName = "2";
}
}

public class TestViewModel : Conductor.Collection.OneActive
{
protected override void OnInitialActivate()
{
base.OnInitialActivate();
Debug.WriteLine("我被激活了");
}
}
`

@canton7 Is this normal?