Replies: 4 comments
-
@canton7 Is this normal? |
Beta Was this translation helpful? Give feedback.
-
I converted this to a discussion, as it is a support request. |
Beta Was this translation helpful? Give feedback.
-
TestViewModel is not used anywhere in your code. |
Beta Was this translation helpful? Give feedback.
-
You're probably after public class MainViewModel : Screen, IInjectionAware
{
[Inject]
public Test2ViewModel Test2VM { get; set; }
public void PropertiesInjected()
{
Test2VM.ConductWith(this);
}
} |
Beta Was this translation helpful? Give feedback.
-
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("我被激活了");
}
}
`
Beta Was this translation helpful? Give feedback.
All reactions