diff --git a/src/BD.WTTS.Client.Avalonia/UI/Styling/Controls/ContentLoader.axaml b/src/BD.WTTS.Client.Avalonia/UI/Styling/Controls/ContentLoader.axaml index 0ca6ee71d..0e444e1ec 100644 --- a/src/BD.WTTS.Client.Avalonia/UI/Styling/Controls/ContentLoader.axaml +++ b/src/BD.WTTS.Client.Avalonia/UI/Styling/Controls/ContentLoader.axaml @@ -6,7 +6,7 @@ x:CompileBindings="True"> - + @@ -50,7 +50,9 @@ + IsVisible="{TemplateBinding IsShowNoResultText}" + Text="{TemplateBinding NoResultMessage}" + Theme="{StaticResource SubtitleTextBlockStyle}" /> + + + + + + + + - - - + + + + + + + + + - - - + + + + diff --git a/src/BD.WTTS.Client.Avalonia/UI/Views/Abstractions/Pages/PageBase.cs b/src/BD.WTTS.Client.Avalonia/UI/Views/Abstractions/Pages/PageBase.cs index bf438534e..2e4755bd7 100644 --- a/src/BD.WTTS.Client.Avalonia/UI/Views/Abstractions/Pages/PageBase.cs +++ b/src/BD.WTTS.Client.Avalonia/UI/Views/Abstractions/Pages/PageBase.cs @@ -1,4 +1,3 @@ -using Avalonia.Controls; using Avalonia.Rendering.Composition; namespace BD.WTTS.UI.Views.Pages; @@ -47,6 +46,12 @@ public class PageBase : UserControl public static readonly StyledProperty HeaderBackgroundProperty = AvaloniaProperty.Register(nameof(HeaderBackground)); + public static readonly StyledProperty PaneContentProperty = + AvaloniaProperty.Register(nameof(PaneContent)); + + public static readonly StyledProperty IsPaneOpenProperty = + SplitView.IsPaneOpenProperty.AddOwner(); + public string Title { get => GetValue(TitleProperty); @@ -89,12 +94,24 @@ public class PageBase : UserControl set => SetValue(ActionContentProperty, value); } + public object? PaneContent + { + get => GetValue(PaneContentProperty); + set => SetValue(PaneContentProperty, value); + } + public bool IsShowBackgroundImage { get => GetValue(IsShowBackgroundImageProperty); set => SetValue(IsShowBackgroundImageProperty, value); } + public bool IsPaneOpen + { + get => GetValue(IsPaneOpenProperty); + set => SetValue(IsPaneOpenProperty, value); + } + public IBrush? HeaderBackground { get => GetValue(HeaderBackgroundProperty); diff --git a/src/BD.WTTS.Client.Avalonia/UI/Views/Controls/ContentLoader.cs b/src/BD.WTTS.Client.Avalonia/UI/Views/Controls/ContentLoader.cs index a09668219..6234685bf 100644 --- a/src/BD.WTTS.Client.Avalonia/UI/Views/Controls/ContentLoader.cs +++ b/src/BD.WTTS.Client.Avalonia/UI/Views/Controls/ContentLoader.cs @@ -1,4 +1,6 @@ using Avalonia.Controls; +using DynamicData; +using FluentAvalonia.Core; namespace BD.WTTS.UI.Views.Controls; @@ -40,6 +42,18 @@ public class ContentLoader : ContentControl public static readonly StyledProperty IsIndeterminateProperty = AvaloniaProperty.Register(nameof(IsIndeterminate), true); + /// + /// Defines the property + /// + public static readonly StyledProperty IsShowNoResultTextProperty = + AvaloniaProperty.Register(nameof(IsShowNoResultText), false); + + /// + /// Defines the property. + /// + public static readonly StyledProperty ItemsSourceProperty = + ItemsControl.ItemsSourceProperty.AddOwner(); + /// /// 是否正在加载中 /// @@ -55,6 +69,12 @@ public class ContentLoader : ContentControl set => SetValue(IsIndeterminateProperty, value); } + public bool IsShowNoResultText + { + get => GetValue(IsShowNoResultTextProperty); + set => SetValue(IsShowNoResultTextProperty, value); + } + /// /// 无结果时提示 /// @@ -85,6 +105,12 @@ public class ContentLoader : ContentControl set => SetValue(MaximumProperty, value); } + public IEnumerable? ItemsSource + { + get => GetValue(ItemsSourceProperty); + set => SetValue(ItemsSourceProperty, value); + } + protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs e) { base.OnPropertyChanged(e); @@ -104,5 +130,29 @@ public class ContentLoader : ContentControl } } } + else if (e.Property == ItemsSourceProperty) + { + var items = e.GetNewValue(); + if (items == null) + { + IsLoading = true; + IsShowNoResultText = false; + } + else if (items.Count() == 0) + { + IsLoading = false; + IsShowNoResultText = true; + } + else if (items.Count() != 0) + { + IsLoading = false; + IsShowNoResultText = false; + } + else + { + IsLoading = true; + IsShowNoResultText = false; + } + } } } diff --git a/src/BD.WTTS.Client.Avalonia/UI/Views/Pages/DebugPage.axaml b/src/BD.WTTS.Client.Avalonia/UI/Views/Pages/DebugPage.axaml index 7452cb0d3..36bea663b 100644 --- a/src/BD.WTTS.Client.Avalonia/UI/Views/Pages/DebugPage.axaml +++ b/src/BD.WTTS.Client.Avalonia/UI/Views/Pages/DebugPage.axaml @@ -72,6 +72,25 @@ Text="Action Button" /> + + + + + + + + - +