Closed wf-soft closed 3 years ago
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?
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("我被激活了");
}
}
`