Skip to content

Commit

Permalink
Merge pull request #17 from ZeroGachis/feature/add-condensed-articles…
Browse files Browse the repository at this point in the history
…-property

Feature/add condensed articles property
  • Loading branch information
azertyValentin authored Nov 10, 2020
2 parents 074b461 + 23653da commit 29f577f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
13 changes: 13 additions & 0 deletions Smartway.UiComponent.Sample/ExpanderCard/ExpanderCardSample.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@
<Label Text="In Section Sheet"></Label>
<cardLists:ExpanderCardList Title="Expander 50 items " Status="warning" SourceList="{Binding Articles}"/>
<cardLists:ExpanderCardList Title="Expander lazy loading 50 items" SourceList="{Binding Articles}" LoadAsync="True"/>
<Label Text="In Section Sheet - Condensed"></Label>
<cards:ExpanderCard Title="Basic Title">
<cards:ExpanderCard.ExpanderTemplate>
<DataTemplate>
<StackLayout>
<cards:ArticleCard Label="Escargot" Gencode="123456" Price="666" IsMultilocation="true" IsCondensed="true"/>
<cards:ArticleCard Label="Escargot 2" Gencode="123456" Price="666" IsMultilocation="true" IsCondensed="true"/>
<cards:ArticleCard Label="Escargot 3" Gencode="123456" Price="666" IsMultilocation="false" IsCondensed="true"/>
<cards:ArticleCard Label="Escargot 4" Gencode="123456" Price="666" IsMultilocation="false" IsCondensed="true"/>
</StackLayout>
</DataTemplate>
</cards:ExpanderCard.ExpanderTemplate>
</cards:ExpanderCard>
</layouts:SectionSheet>
</StackLayout>
</ScrollView>
Expand Down
5 changes: 4 additions & 1 deletion Smartway.UiComponent/Cards/ArticleCard.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</Style>
<Style x:Key="ProductImage" TargetType="Image">
<Setter Property="Margin" Value="0, 0, 5, 0"></Setter>
<Setter Property="WidthRequest" Value="90"></Setter>
<Setter Property="WidthRequest" Value="90" />
</Style>
<Style x:Key="RegularGencodeText" TargetType="Label">
<Setter Property="HorizontalTextAlignment" Value="Start"></Setter>
Expand Down Expand Up @@ -44,6 +44,9 @@
<DataTrigger TargetType="Image" Binding="{Binding Source={Reference Self}, Path=IsMultilocation}" Value="false">
<Setter Property="Source" Value="{utils:ImageResource Source=Smartway.UiComponent.Resources.Images.img_product_placeholder.png}" />
</DataTrigger>
<DataTrigger TargetType="Image" Binding="{Binding Source={Reference Self}, Path=IsCondensed}" Value="true">
<Setter Property="WidthRequest" Value="60" />
</DataTrigger>
</Image.Triggers>
</Image>
<StackLayout Orientation="Vertical">
Expand Down
7 changes: 7 additions & 0 deletions Smartway.UiComponent/Cards/ArticleCard.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,20 @@ public partial class ArticleCard
public static readonly BindableProperty NavigationParameterProperty = BindableProperty.Create(nameof(NavigationParameter), typeof(object), typeof(ArticleCard));
public static readonly BindableProperty OnShortageSinceProperty = BindableProperty.Create(nameof(OnShortageSince), typeof(DateTime?), typeof(ArticleCard), DateTime.Today);
public static readonly BindableProperty StatusProperty = BindableProperty.Create(nameof(Status), typeof(string), typeof(ArticleCard), "Unknown");
public static readonly BindableProperty IsCondensedProperty = BindableProperty.Create(nameof(IsCondensed), typeof(bool), typeof(ArticleCard), false);

public bool IsMultilocation
{
get => (bool) GetValue(IsMultilocationProperty);
set => SetValue(IsMultilocationProperty, value);
}

public bool IsCondensed
{
get => (bool)GetValue(IsCondensedProperty);
set => SetValue(IsCondensedProperty, value);
}

public string Label
{
get => (string) GetValue(LabelProperty);
Expand Down

0 comments on commit 29f577f

Please sign in to comment.