-
Hello! I don't know what to do with this problem so i ask it here. When i add a Command to my Button, it's always disabled. Here is the XAML code of my button:
And here is the method code in ViewModel:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
https://docs.avaloniaui.net/docs/data-binding/binding-to-commands#binding-to-methods |
Beta Was this translation helpful? Give feedback.
-
Nevermind, i fixed it. I was making new Window appear like this: Window addNewWindow = new AddNewWindow();
addNewWindow.Show(); But then i added DataContext to it Window addNewWindow = new AddNewWindow();
addNewWindow.DataContext = new AddNewWindowViewModel();
addNewWindow.Show(); And everything worked nice. |
Beta Was this translation helpful? Give feedback.
Nevermind, i fixed it.
I was making new Window appear like this:
But then i added DataContext to it
And everything worked nice.