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

(Tutorial) ReactiveCommands in ViewModel constructor don't work #4475

Closed
Rhywun opened this issue Aug 11, 2020 · 6 comments
Closed

(Tutorial) ReactiveCommands in ViewModel constructor don't work #4475

Rhywun opened this issue Aug 11, 2020 · 6 comments

Comments

@Rhywun
Copy link

Rhywun commented Aug 11, 2020

I am following the tutorial on macOS 10.15.5 and .NET Core 3.0. All is well until the final page which adds the functionality for the OK and Cancel buttons in the constructor of the AddItemViewModel class. There are two problems upon running:

  1. The "OK" button remains disabled when I enter text in the Description field.
  2. The "Cancel" button results in a blank window instead of returning to the TodoListView.

Screen01

Repro here.

Thanks

@FoggyFinder
Copy link
Contributor

  1. You wrote Command="{Binding OK}" instead of Command="{Binding Ok}"

https://github.com/Rhywun/avalonia-todo/blob/master/Views/AddItemView.xaml#L13

  1. You didn't initialize List property

Content = new TodoListViewModel(db.GetItems());

while it should be

Content = List = new TodoListViewModel(db.GetItems());

https://github.com/Rhywun/avalonia-todo/blob/master/ViewModels/MainWindowViewModel.cs#L14

@Rhywun
Copy link
Author

Rhywun commented Aug 11, 2020

Thank you!! Everything works now.

Ugh I remember typing in your second line and I thought it was a misprint :)
That kind of double assignment rubs me the wrong way.

Might I suggest providing the source code for the tutorial on the website? I didn't find it in the framework's samples/ directory either. It might help others by providing a way to diff any changes.

@rstm-sf
Copy link
Contributor

rstm-sf commented Aug 11, 2020

Hello! Link is already exist:

You can find the code for the completed application here.
https://avaloniaui.net/docs/tutorial/

@Rhywun
Copy link
Author

Rhywun commented Aug 11, 2020

Great, thanks! I missed it.

Closing

@Rhywun Rhywun closed this as completed Aug 11, 2020
@FoggyFinder
Copy link
Contributor

Thank you!! Everything works now.

Happy to help. Btw, there are also places where you can ask Qs about Avalonia:

First two are probably preferable since they have "official" (mention in ReadMe) support.

I do think it would better than raise issues especially in case of something simple. Avalonia has reached the good shape and answering questions is area where community can help easily.

To emphasize: this is only my personal position and maintainers may think differently.

My arguments are the following:

  • Questions distract from working on fixing bugs, implementing new features etc.

  • It might be annoying for watchers to receive notifications about something simple like "WebView ??" again and again.

  • Sometimes issues don't recive any response anyway

  • and even when the answer is provided issue is not always marked as "closed" therefore reports about possibly crucial bugs go down and down.

@Rhywun
Copy link
Author

Rhywun commented Aug 11, 2020

"Chat" is not my favorite format but I will take it under consideration. Thanks

PS. The progress since I first looked at Avalonia a couple years ago is fantastic. Much appreciated.

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

3 participants