using Avalonia; using Avalonia.Controls; namespace DodoSSH.Client.App.Views; /// /// The screen behind a nav-rail entry whose feature does not exist yet. /// /// /// /// Styled properties set from XAML rather than a view model, because there is no state here — a screen /// saying what is absent has nothing to observe, and a view model per absent feature would be two classes /// whose only job is to hold four strings. /// /// /// takes the list rather than the markup listing it inline, so the two instances of /// this control differ only in their content and the layout is written once. /// /// internal sealed partial class NotBuiltScreen : UserControl { /// What the feature is called, in the design's own words. public static readonly StyledProperty TitleProperty = AvaloniaProperty.Register(nameof(Title), string.Empty); /// Which milestone it belongs to, so the chip is a fact and not an apology. public static readonly StyledProperty MilestoneProperty = AvaloniaProperty.Register(nameof(Milestone), string.Empty); /// One paragraph on what the design shows and why none of it is here. public static readonly StyledProperty SummaryProperty = AvaloniaProperty.Register(nameof(Summary), string.Empty); /// The specific pieces, each naming the layer it would land in. public static readonly StyledProperty?> MissingProperty = AvaloniaProperty.Register?>(nameof(Missing)); /// What somebody wanting this today should do instead. public static readonly StyledProperty InsteadProperty = AvaloniaProperty.Register(nameof(Instead), string.Empty); public NotBuiltScreen() { InitializeComponent(); // Bound in code rather than in the markup, because the markup's own DataContext is the shell and // these five are properties of this control. Self-bindings in XAML would need a relative source on // every one of them, which is five chances to point one at the wrong object. TitleText.Bind(TextBlock.TextProperty, this.GetObservable(TitleProperty)); MilestoneText.Bind(TextBlock.TextProperty, this.GetObservable(MilestoneProperty)); SummaryText.Bind(TextBlock.TextProperty, this.GetObservable(SummaryProperty)); InsteadText.Bind(TextBlock.TextProperty, this.GetObservable(InsteadProperty)); MissingList.Bind(ItemsControl.ItemsSourceProperty, this.GetObservable(MissingProperty)); } /// public string Title { get => GetValue(TitleProperty); set => SetValue(TitleProperty, value); } /// public string Milestone { get => GetValue(MilestoneProperty); set => SetValue(MilestoneProperty, value); } /// public string Summary { get => GetValue(SummaryProperty); set => SetValue(SummaryProperty, value); } /// public IEnumerable? Missing { get => GetValue(MissingProperty); set => SetValue(MissingProperty, value); } /// public string Instead { get => GetValue(InsteadProperty); set => SetValue(InsteadProperty, value); } }