Closed SimonORorke closed 7 months ago
Needs to be surrounded by an if statement - if (Design.IsDesignMode).
Done.
Consider: "Setting the design-time
DataContext
in XAML directly is only possible if the ViewModel has a parameterless constructor." It's not strictly correct, but creating a customMarkupExtension
to use a service locator and construct the correct VM is complicated for docs.
Done. To accommodate the point that it's not strictly correct, I replaced the suggested 'directly' with 'by one of the methods shown above'.
Should change the links to be rooted or relative
Done. I went for relative, as I can test that on my computer.
This perhaps should be in how-to-use-design-time-data instead, but up to you / other reviewers.
My rationale for leaving the new documentation on the 'How to Use Live Preview' page:
In relation to this point, I have changed the name of the view model in the example from MyViewModel
(following other examples on the page), to MainWindowViewModel
. This seems apt, as the technique is most likely to be used with the run-time view model rather than a special design-time view model.
Changes look good. Thanks for the contribution.
https://github.com/AvaloniaUI/avalonia-docs/issues/466