59 lines
1.7 KiB
C#
59 lines
1.7 KiB
C#
using System.Collections;
|
|
using Avalonia;
|
|
using Avalonia.Controls;
|
|
using Avalonia.Controls.Templates;
|
|
|
|
namespace AutoCat.Views;
|
|
|
|
public partial class MasterDetailView : UserControl
|
|
{
|
|
#region Dependency properties
|
|
|
|
public static readonly StyledProperty<IDataTemplate?> ItemTemplateProperty =
|
|
AvaloniaProperty.Register<MasterDetailView, IDataTemplate?>(nameof(ItemTemplate));
|
|
|
|
public static readonly StyledProperty<IDataTemplate?> DetailTemplateProperty =
|
|
AvaloniaProperty.Register<MasterDetailView, IDataTemplate?>(nameof(DetailTemplate));
|
|
|
|
public static readonly StyledProperty<IDataTemplate?> EmptyDetailTemplateProperty =
|
|
AvaloniaProperty.Register<MasterDetailView, IDataTemplate?>(nameof(EmptyDetailTemplate));
|
|
|
|
public static readonly StyledProperty<IEnumerable?> ItemsSourceProperty =
|
|
AvaloniaProperty.Register<MasterDetailView, IEnumerable?>(nameof(ItemsSource));
|
|
|
|
#endregion
|
|
|
|
#region Properties
|
|
|
|
public IDataTemplate? ItemTemplate
|
|
{
|
|
get => GetValue(ItemTemplateProperty);
|
|
set => SetValue(ItemTemplateProperty, value);
|
|
}
|
|
|
|
public IDataTemplate? DetailTemplate
|
|
{
|
|
get => GetValue(DetailTemplateProperty);
|
|
set => SetValue(DetailTemplateProperty, value);
|
|
}
|
|
|
|
public IDataTemplate? EmptyDetailTemplate
|
|
{
|
|
get => GetValue(EmptyDetailTemplateProperty);
|
|
set => SetValue(EmptyDetailTemplateProperty, value);
|
|
}
|
|
|
|
public IEnumerable? ItemsSource
|
|
{
|
|
get => GetValue(ItemsSourceProperty);
|
|
set => SetValue(ItemsSourceProperty, value);
|
|
}
|
|
|
|
#endregion
|
|
|
|
public MasterDetailView()
|
|
{
|
|
InitializeComponent();
|
|
DataContext = this;
|
|
}
|
|
} |