diff --git a/Stars Assistant/Stars Assistant.csproj b/Stars Assistant/Stars Assistant.csproj
index 9e540ba..ef96db4 100644
--- a/Stars Assistant/Stars Assistant.csproj
+++ b/Stars Assistant/Stars Assistant.csproj
@@ -27,6 +27,7 @@
+
diff --git a/Stars Assistant/ViewModels/MainWindowViewModel.cs b/Stars Assistant/ViewModels/MainWindowViewModel.cs
index 81bb73b..81c8068 100644
--- a/Stars Assistant/ViewModels/MainWindowViewModel.cs
+++ b/Stars Assistant/ViewModels/MainWindowViewModel.cs
@@ -1,5 +1,8 @@
using System.Collections.ObjectModel;
+using System.Reactive.Disposables;
+using System.Reactive.Linq;
using ReactiveUI;
+using ReactiveUI.SourceGenerators;
namespace StarsAssistant.ViewModels;
@@ -7,6 +10,24 @@ public partial class MainWindowViewModel : ViewModelBase, IActivatableViewModel
{
public ViewModelActivator Activator { get; } = new ViewModelActivator();
+ [ObservableAsProperty]
+ private string _welcomeMessage;
+
+ public MainWindowViewModel()
+ {
+ _welcomeMessage = "Lorem Ipsum";
+ _welcomeMessageHelper = Observable.Return("Dolor sit amet")
+ .ToProperty(this, x => x.WelcomeMessage);
+
+ this.WhenActivated((CompositeDisposable disposables) =>
+ {
+ // /* handle activation */
+ // Disposable
+ // .Create(() => { /* handle deactivation */ })
+ // .DisposeWith(disposables);
+ });
+ }
+
public ObservableCollection Planets { get; } = PlanetViewModel.LoadAll();
}
diff --git a/Stars Assistant/Views/MainWindow.axaml b/Stars Assistant/Views/MainWindow.axaml
index 13afb4c..1f2e8a9 100644
--- a/Stars Assistant/Views/MainWindow.axaml
+++ b/Stars Assistant/Views/MainWindow.axaml
@@ -19,10 +19,10 @@
- Welcome to Stars Assistant!
+ Hi
-
{
public MainWindow()
{
- AvaloniaXamlLoader.Load(this);
+ this.WhenActivated(
+
+ disposables => {
+ this.OneWayBind(ViewModel,
+ viewModel => viewModel.Planets,
+ view => view.PlanetsGrid.ItemsSource)
+ .DisposeWith(disposables);
+ this.OneWayBind(ViewModel,
+ vm => vm.WelcomeMessage,
+ v => v.WelcomeText.Text)
+ .DisposeWith(disposables);
+ }
+ );
+
+ InitializeComponent();
}
+
}
\ No newline at end of file