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

Comments

Projects
None yet
2 participants
@ajeebkp23
Copy link

ajeebkp23 commented Sep 22, 2016

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

This comment has been minimized.

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.

@MarkWithall MarkWithall added the bug label Sep 23, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment