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

Empty value at the text box result in exception #1

Closed
ajeebkp23 opened this issue Sep 22, 2016 · 1 comment
Closed

Empty value at the text box result in exception #1

ajeebkp23 opened this issue Sep 22, 2016 · 1 comment
Labels

Comments

@ajeebkp23
Copy link

I am a beginner in WPF. So I coded the entire blog article at my own will. Then I found it is leading to an exception when input box is empty. Here is my code, on which I fixed the error. https://github.com/ajeebkp23/Simplest-WPF-MVVM-Example. Since, I didn't forked your code I am not coming with a PR.

@MarkWithall
Copy link
Owner

MarkWithall commented Sep 23, 2016

Indeed it does. Well spotted. I'm surprised that no one else has noticed this before. Thanks for letting me know.

The question is now, is it better for:

  • the TextConverter convertion [sic] parameter (which is spelled wrong in the example) to handle null in the model;
  • or, SomeText in Presenter to not allow null in the viewmodel (by initialising it to an empty string)
  • or, ConvertText to do nothing if SomeText is null (and possibly empty string too) - and maybe pop up a message box informing the user

This would be a much tidier fix in C# 6.0; I must create a branch with a C# 6.0 version of the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants