A cross-platform UI framework for .NET
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

30 lines
863 B

using Avalonia;
using Avalonia.Controls;
using Avalonia.VisualTree;
using ControlCatalog.ViewModels;
namespace ControlCatalog.Pages
{
public partial class PlatformSettingsPage : ContentPage
{
private readonly PlatformSettingsViewModel _viewModel = new();
public PlatformSettingsPage()
{
InitializeComponent();
DataContext = _viewModel;
}
protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)
{
base.OnAttachedToVisualTree(e);
_viewModel.Subscribe(this.GetPlatformSettings() ?? Application.Current?.PlatformSettings);
}
protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e)
{
_viewModel.Unsubscribe();
base.OnDetachedFromVisualTree(e);
}
}
}