Fix UserControl Interaction

This commit is contained in:
Torben Nehmer 2024-09-23 21:28:33 +02:00
parent c2b265afd1
commit 782965ce49
3 changed files with 9 additions and 9 deletions

View File

@ -12,14 +12,16 @@ public partial class MainWindowViewModel : ViewModelBase, IActivatableViewModel
{
public ViewModelActivator Activator { get; } = new ViewModelActivator();
[ObservableAsProperty]
private string _dbPath = "";
[Reactive]
private string _dbPath;
[Reactive]
private BuColViewModel? _buColViewModel = new();
public MainWindowViewModel()
{
using var db = Locator.Current.GetService<StarsDatabase>()!;
_dbPathHelper = Observable.Return(Path.GetFullPath(db.DbPath))
.ToProperty(this, x => x.DbPath);
DbPath = Path.GetFullPath(db.DbPath);
this.WhenActivated((CompositeDisposable disposables) =>
{

View File

@ -1,3 +1,4 @@
using System.ComponentModel.DataAnnotations;
using System.Reactive.Disposables;
using Avalonia;
using Avalonia.Controls;
@ -12,13 +13,9 @@ public partial class BuColView : ReactiveUserControl<BuColViewModel>
{
public BuColView()
{
/*
this.WhenActivated(disposables =>
{
});
*/
this.ViewModel = new BuColViewModel();
InitializeComponent();
}

View File

@ -26,7 +26,8 @@
</Grid>
</TabItem>
<TabItem Header="BuCol">
<views:BuColView />
<views:BuColView x:Name="BuColView"
DataContext="{Binding BuColViewModel}" />
</TabItem>
</TabControl>
</Window>