I need to write a small application to read the configuration file and generate some report with it. I was hoping to finally use MVVM, but it's pretty hard to get started. Oh, I'm using Caliburn.Micro.
So, this is what I have, a shell (the main view, on which other views are placed), on which there is a ribbon with 3 buttons:
1) Open file 2) Show settings 3) Show results
And two more views, SettingsView and ResultsView with buttons for creating and deleting a report.
So, I assume that the presentation structure will be like this:
ShellView Ribbon OpenFileButton SettingsButton ResultsButton ContentControl (hosts SettingsView and ResultsView) SettingsView CalculateResultsButton ResultsView CancelResultsButton
The hard part:
1. "Show settings" button is disabled until a file is opened (via Open file). 2. "Show results" button is disabled until a report is calculated (via a method in SettingsViewModel). 3. If a report is calculated, the CalculateResultsButton is disabled and CancelResultsButton is enabled and vice versa.
Please let me know how I could achieve this. I have no idea what strategy I should go for. My brain, other than MVVM, says that I have to create a status variable and then somehow bind these buttons to this variable, but I suppose that won't work in the MVVM world, right? Any code sample would be very much appreciated!
Many thanks!
source share