Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ViewModel-eval 赋值给Member时空指针异常 #52

Closed
roodkcab opened this issue Aug 2, 2020 · 1 comment
Closed

ViewModel-eval 赋值给Member时空指针异常 #52

roodkcab opened this issue Aug 2, 2020 · 1 comment

Comments

@roodkcab
Copy link
Member

roodkcab commented Aug 2, 2020

在Resource里组合多个页面时

<Window Text="GacPass" ClientSize="x:480 y:320">
  <gacpass:RegisterWindow Visible-bind="not ViewModel.MainPasswordSet" ViewModel-eval="ViewModel.RegisterViewModel"></gacpass:RegisterWindow>
  <gacpass:LoginWindow Visible-bind="ViewModel.MainPasswordSet and not ViewModel.LoggedIn"></gacpass:LoginWindow>
  <gacpass:CodeBookWindow Visible-bind="ViewModel.MainPasswordSet and ViewModel.LoggedIn"></gacpass:CodeBookWindow>
</Window>

ViewModel.RegisterViewModel只能当参数(ref.Parameter)传给RegisterWindow,但是使用ref.Members就会空指针

CHECK_ERROR(thisValue != nullptr, L"The this pointer cannot be null.");

如果想用Members该怎么写呢?

@vczh
Copy link
Member

vczh commented Aug 7, 2020

可能可以这样
ViewModel-bind="ViewModel.RegisterViewModel ?? null"
不过我比较好奇,ref.Parameter是在构造函数的参数,赋值了之后就不能改了,为什么会是null?

@vczh vczh closed this as completed Aug 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants