Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Char0394/c6f3349e67f08c9198dbbf69c3b69fc5 to your computer and use it in GitHub Desktop.
Save Char0394/c6f3349e67f08c9198dbbf69c3b69fc5 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="UTF-8"?>
<view:BaseProductEntryCardView xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="SalesHub.Framework.Components.Products.ProductEntryTruckLoadForecastCardView"
xmlns:view="clr-namespace:SalesHub.Framework.Components.Products"
VerticalOptions="Start"
xmlns:forms="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms">
<ContentView.ControlTemplate>
<ControlTemplate x:Key="Page">
<Grid>
<Frame Style="{StaticResource CardFrame}"
Margin="16,16,16,13"
Padding="0"
VerticalOptions="Start">
<Frame.Triggers>
<DataTrigger TargetType="Frame"
Binding="{TemplateBinding IsSelected}"
Value="True">
<Setter Property="BorderColor" Value="{StaticResource Primary}" />
</DataTrigger>
</Frame.Triggers>
<Grid RowSpacing="0"
ColumnSpacing="10"
HorizontalOptions="Fill"
AutomationId="MainProductLayout"
RowDefinitions="16, 5*, Auto, Auto"
ColumnDefinitions="Auto,88, Auto, Auto">
<Image Grid.Column="0"
Grid.Row="1"
Grid.RowSpan="3"
AutomationId="SelectedIndicator"
Source="GreenChecked"
Margin="15,0,0,25"
Style="{StaticResource SmallHeightImage}"
IsVisible="{Binding IsShowCheck}"
VerticalOptions="Center">
<Image.Triggers>
<DataTrigger TargetType="Image"
Binding="{TemplateBinding IsSelectedCheck}"
Value="False">
<Setter Property="Source" Value="GreenUnchecked" />
</DataTrigger>
</Image.Triggers>
<Image.GestureRecognizers>
<TapGestureRecognizer Tapped="OnSelectTapped" />
</Image.GestureRecognizers>
</Image>
<!-- Cache duration is currently set to default [90 days] -->
<forms:CachedImage Source="{Binding TargetNullValue='ChipBag'}"
ErrorPlaceholder="ChipBag"
LoadingPlaceholder="ChipBag"
Aspect="AspectFit"
BindingContext="{TemplateBinding ImagePath}"
AutomationId="ProductImage"
WidthRequest="64"
HeightRequest="84"
Margin="0,0,0,25"
VerticalOptions="Start"
Grid.Column="1"
Grid.Row="1"
Grid.RowSpan="3" />
<ImageButton Source="Information"
IsVisible="{TemplateBinding IsInformationIconVisible}"
AutomationId="InformationImage"
HeightRequest="40"
WidthRequest="40"
Margin="0,55,0,25"
Padding="10"
HorizontalOptions="Start"
Grid.Column="1"
Grid.Row="1"
Grid.RowSpan="3"
Command="{TemplateBinding InformationTappedCommand}"
CommandParameter="{Binding Source={RelativeSource AncestorType={x:Type view:ProductEntryCardView}}, Path=BindingContext}" />
<Label Text="{TemplateBinding PromotionText}"
IsVisible="{TemplateBinding HasPromotion}"
LineBreakMode="TailTruncation"
VerticalOptions="End"
Style="{StaticResource SemiBoldSecondaryMicroLabel}"
Margin="0"
AutomationId="PromotedItemTextLabel"
Grid.Column="2"
Grid.ColumnSpan="2"
Grid.Row="0" />
<Label Text="{TemplateBinding Description}"
MaxLines="2"
Style="{StaticResource MediumLabel}"
AutomationId="DescriptionLabel"
Grid.Column="2"
Grid.Row="1" />
<StackLayout Grid.Column="2"
Grid.Row="2"
Margin="{StaticResource BottomMediumThickness}">
<Label Text="{TemplateBinding Item}"
VerticalOptions="End"
Style="{StaticResource MediumLabel}"
AutomationId="UPCLabel" />
<Label Text="{TemplateBinding PackageType}"
Style="{StaticResource MediumLabel}"
IsVisible="{Binding ShowPackageType, Source={RelativeSource AncestorType={x:Type view:ProductEntryCardView}}}"
AutomationId="PackageTypeLabel" />
</StackLayout>
<StackLayout Grid.Row="0"
Grid.RowSpan="4"
Grid.Column="3
HorizontalOptions="End"
Spacing="0">
<Label Text="{x:Static resources:Resources.QTY}"
Style="{StaticResource SemiBoldSecondaryMicroLabel}"
Margin="16,10,25,2"
Padding="0,6,0,0"
AutomationId="QtyLabel">
<Label.Triggers>
<DataTrigger TargetType="Label"
Binding="{Binding ShowPackageDisplayAsEach}"
Value="True">
<Setter Property="Text"
Value="{Binding EachesQuantityHeading, Converter={x:StaticResource ToUpperCaseConverter}, Source={RelativeSource AncestorType={x:Type view:ProductEntryTruckLoadForecastCardView}}}" />
</DataTrigger>
</Label.Triggers>
</Label>
<Label Text="{Binding Quantity, StringFormat='{0:N0}'}"
x:Name="QtyEntryLabel"
Margin="{StaticResource LeftMediumTopMicroBottomMicroVariantThickness}"
TextColor="{Binding QuantityColor}"
Style="{StaticResource MediumLabel}"
AutomationId="QtyValueLabel"/>
<ImageButton Source="OutOfStore"
IsVisible="{Binding IsInStoreVisible}"
Style="{StaticResource SquareMediumImageButton}"
Margin="{StaticResource TopBodyVariantRightBottomMediumThickness}"
AutomationId="OutOfStoreImage" >
<ImageButton.Triggers>
<DataTrigger TargetType="ImageButton"
Binding="{Binding IsInStore}"
Value="True">
<Setter Property="Source" Value="InStore"/>
</DataTrigger>
</ImageButton.Triggers>
</ImageButton>
<StackLayout.GestureRecognizers>
<TapGestureRecognizer Command="{Binding QuantityTappedCommand}"
CommandParameter="{Binding Source={RelativeSource AncestorType={x:Type view:ProductEntryTruckLoadForecastQuantityCardView}}, Path=BindingContext}"/>
</StackLayout.GestureRecognizers>
</StackLayout>
</Grid>
</Frame>
</Grid>
</ControlTemplate>
</ContentView.ControlTemplate>
</view:BaseProductEntryCardView>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment