<ViewCell xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="TVApps.Controls.AppItemCell">
- <AbsoluteLayout Margin="13,13,13,13">
- <Button x:Name="ItemBackgroundButton"
- Opacity="0"
- AbsoluteLayout.LayoutBounds="0,0,210,290"/>
- <BoxView x:Name="ItemBackgroundBox"
- AbsoluteLayout.LayoutBounds="0,0,210,290"
- Color="{Binding IconColor}"/>
- <Grid AbsoluteLayout.LayoutBounds="10,10,190,270">
- <Grid.RowDefinitions>
- <RowDefinition Height="4*" />
- <RowDefinition Height="1*" />
- </Grid.RowDefinitions>
- <Grid.RowSpacing>0</Grid.RowSpacing>
- <Grid.ColumnSpacing>0</Grid.ColumnSpacing>
- <Image Grid.Row="0"
- Grid.Column="0"
- Source="{Binding IconUrl}"/>
- <Label Grid.Row="1"
- Grid.Column="0"
- TextColor="#FFFFFF"
- HorizontalTextAlignment="Center"
- Text="{Binding Title}"
- FontSize="40"/>
- </Grid>
- </AbsoluteLayout>
+ <RelativeLayout BackgroundColor="#000000">
+ <BoxView x:Name="ButtonBox"
+ WidthRequest="240"
+ HeightRequest="266"
+ Opacity="0"/>
+ <Image x:Name="ButtonImage"
+ RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.6165}"
+ RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0.6833}"
+ RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.0977}"
+ RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0.1583}"
+ Source="{Binding IconUrl}" />
+ <Label x:Name="ButtonTitle"
+ RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.78195}"
+ RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0.1167}"
+ RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0.7667}"
+ RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.1203}"
+ Opacity="1"
+ FontSize="58"
+ TextColor="White"
+ LineBreakMode="TailTruncation"
+ HorizontalTextAlignment="Center"
+ Text="{Binding Title}" />
+ <Image x:Name="PinnedIcon"
+ RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.075}"
+ RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0.075}"
+ RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.78195}"
+ RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonTitle, Property=Width, Factor=0}"
+ Source="{Binding IconUrl}"
+ Opacity="0"/>
+ <Button x:Name = "ButtonFocusArea"
+ RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=1}"
+ RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=1}"
+ Focused="OnFocused"
+ Unfocused="OnUnFocused"
+ Opacity="0" />
+ </RelativeLayout>
</ViewCell>
/// </summary>
public partial class AppItemCell : ViewCell
{
- Color itemBackgroundColor;
public AppItemCell()
{
- Random r = new Random();
InitializeComponent();
- itemBackgroundColor = Color.Default;
- ItemBackgroundBox.PropertyChanged += OnItemBackgroundColorChange;
- ItemBackgroundButton.Focused += ItemButton_Focused;
- ItemBackgroundButton.Unfocused += ItemButton_Unfocused;
}
- private void OnItemBackgroundColorChange(object sender, PropertyChangedEventArgs e)
+ private void OnFocused(object sender, EventArgs e)
{
- if (e.PropertyName == "Color")
- {
- itemBackgroundColor = ItemBackgroundBox.Color;
- ItemBackgroundBox.PropertyChanged -= OnItemBackgroundColorChange;
- }
+ ButtonImage.ScaleTo(1.32, 300);
+ ButtonTitle.TranslateTo(0, 26, 300);
}
- private void ItemButton_Focused(object sender, FocusEventArgs e)
+ private void OnUnFocused(object sender, EventArgs e)
{
- ItemBackgroundBox.Color = Color.Blue;
- }
-
- private void ItemButton_Unfocused(object sender, FocusEventArgs e)
- {
- ItemBackgroundBox.Color = itemBackgroundColor;
+ ButtonImage.ScaleTo(1.0, 300);
+ ButtonTitle.TranslateTo(0, 0, 300);
}
}
}
</Controls:AppListView.ItemTemplate>
<Grid x:Name="AppListGrid"
- HorizontalOptions="Start"
- Padding="60,60,60,60">
+ HorizontalOptions="Start">
<Grid.RowDefinitions>
- <RowDefinition Height="1*" />
- <RowDefinition Height="1*" />
+ <RowDefinition Height="4863*" />
+ <RowDefinition Height="274*" />
+ <RowDefinition Height="4863*" />
</Grid.RowDefinitions>
<Grid.RowSpacing>0</Grid.RowSpacing>
<Grid.ColumnSpacing>0</Grid.ColumnSpacing>
Orientation="Horizontal"
HorizontalOptions="Start"
Spacing="0"/>
+ <BoxView Grid.Row="1"/>
<StackLayout x:Name="AppLowerList"
- Grid.Row="1"
+ Grid.Row="2"
Orientation="Horizontal"
HorizontalOptions="Start"
Spacing="0"/>