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

WPF Tutorial part 2 #47

Open
RudolfJan opened this issue Jan 19, 2022 · 4 comments
Open

WPF Tutorial part 2 #47

RudolfJan opened this issue Jan 19, 2022 · 4 comments

Comments

@RudolfJan
Copy link
Contributor

The second part of the WPF tutorial will cover this:

  • How to add and use a menu
  • How to add and use a dialog form, including using a WindowManager
  • A link from the documentation index
  • Created source code will be made available in the examples section of the Caliburn.Micro github
@RudolfJan
Copy link
Contributor Author

RudolfJan commented Jan 19, 2022

I have a question for this second part of the tutorial. For NotifyOfPropertyChange, I introduced two ways of supplying it with the parameter:

NotifyOfPropertyChange("ModName");
NotifyOfPropertyChange(() => ModName);

I used to prefer the second one. But I recently found a third way to do it:

NotifyOfPropertyChange(nameof(ModName));
Since this is part of the C# language (starting with version 6.0) I think this method could be preferred. If, so I will change it in the tutorial. Please let me know your opinion.

@Aixtreme-Agile
Copy link

I don't use any parameter if I use NotifyOfPropertyChange() in Setter of property ModName.
(Very seldom case in my experience till now) Outside of the setter I would prefer the second one NotifyOfPropertyChange(()=>ModName), because it does not involve any hardcoded literals and it looks elegant :-)

@Yinimi
Copy link

Yinimi commented Jan 27, 2022

Hi, it's a cool idea to create a tutorial how to build up a new project.
I have a few recommendations / questions to improve it further:

  1. You could use Set() as it allows you to write it as oneliner.
public string UserName
{
    get => _userName;
    set => Set(ref _userName, value);
}
  1. Two or three images look broken for me:
    image

  2. MEF is not an IoC container, it's purpose is to load assemblies dynamicly for loose coupling.
    Maybe it would be better to use the integrated SimpleContainer instead.

@KasperSK
Copy link
Member

I think @Yinimi is right it is a god idea to use Set().

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

4 participants