From 32b86d0aaccfe633e8081d597045804c077b7357 Mon Sep 17 00:00:00 2001 From: "m.bazire" Date: Thu, 12 Nov 2020 11:13:12 +0100 Subject: [PATCH] adapt ArticleCardList to CondensedValue --- .../SectionSheet/Views/SectionSheetSample.xaml | 13 ++++++++++--- Smartway.UiComponent/CardLists/ArticleCardList.xaml | 4 +++- .../CardLists/ArticleCardList.xaml.cs | 8 +++++++- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Smartway.UiComponent.Sample/SectionSheet/Views/SectionSheetSample.xaml b/Smartway.UiComponent.Sample/SectionSheet/Views/SectionSheetSample.xaml index 6354b67..ed1a32f 100644 --- a/Smartway.UiComponent.Sample/SectionSheet/Views/SectionSheetSample.xaml +++ b/Smartway.UiComponent.Sample/SectionSheet/Views/SectionSheetSample.xaml @@ -8,9 +8,16 @@ x:DataType="viewModels:SectionSheetSampleViewModel"> - - - + + + + + + \ No newline at end of file diff --git a/Smartway.UiComponent/CardLists/ArticleCardList.xaml b/Smartway.UiComponent/CardLists/ArticleCardList.xaml index 09a5bcd..6419119 100644 --- a/Smartway.UiComponent/CardLists/ArticleCardList.xaml +++ b/Smartway.UiComponent/CardLists/ArticleCardList.xaml @@ -4,7 +4,8 @@ xmlns:cards="clr-namespace:Smartway.UiComponent.Cards;assembly=Smartway.UiComponent" xmlns:separators="clr-namespace:Smartway.UiComponent.Separators;assembly=Smartway.UiComponent" x:Class="Smartway.UiComponent.CardLists.ArticleCardList" - x:Name="List"> + x:Name="List" + > @@ -20,6 +21,7 @@ NavigationCommand="{Binding NavigationCommand}" NavigationParameter="{Binding NavigationParameter}" OnShortageSince="{Binding OnShortageSince}" + IsCondensed="{Binding Source={x:Reference List}, Path=IsCondensed}" /> diff --git a/Smartway.UiComponent/CardLists/ArticleCardList.xaml.cs b/Smartway.UiComponent/CardLists/ArticleCardList.xaml.cs index 00ce027..214726e 100644 --- a/Smartway.UiComponent/CardLists/ArticleCardList.xaml.cs +++ b/Smartway.UiComponent/CardLists/ArticleCardList.xaml.cs @@ -10,6 +10,7 @@ namespace Smartway.UiComponent.CardLists public partial class ArticleCardList { public static readonly BindableProperty ArticlesListProperty = BindableProperty.Create(nameof(ArticlesList), typeof(ObservableCollection), typeof(ArticleCardList)); + public static readonly BindableProperty IsCondensedProperty = BindableProperty.Create(nameof(IsCondensed), typeof(bool), typeof(ArticleCardList), false); public ObservableCollection ArticlesList { @@ -23,9 +24,14 @@ public ArticleCardList() ArticleListElement.PropertyChanged += ArticleListChanged; } + public bool IsCondensed + { + get => (bool) GetValue(IsCondensedProperty); + set => SetValue(IsCondensedProperty, value); + } + private void ArticleListChanged(object sender, PropertyChangedEventArgs e) { - OnPropertyChanged(nameof(ArticlesList)); var element = ArticleListElement.Children.Cast().FirstOrDefault(_ => _.IsVisible); if (element != null) {