summaryrefslogtreecommitdiff
path: root/PagesGallery/PagesGallery/App.xaml
blob: 18a5e0f378d3c74fca26c2ec3eb8ab1d675a9f20 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?xml version="1.0" encoding="utf-8" ?>
<Application xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:PagesGallery"
             xmlns:p="clr-namespace:Xamarin.Forms.Pages;assembly=Xamarin.Forms.Pages"
             x:Class="PagesGallery.App">
  <Application.Resources>
    <ResourceDictionary>

      <local:CapitalizationConverter x:Key="capitalizeConverter" />

      <Style x:Key="EventPageStyle" TargetType="p:DataPage">
        <Setter Property="ControlTemplate">
          <ControlTemplate>
            <p:ListDataPageControl />
          </ControlTemplate>
        </Setter>
      </Style>

      <Style Class="Speakers" ApplyToDerivedTypes="True" CanCascade="True" TargetType="p:DataPage" BasedOn="{StaticResource EventPageStyle}" />

      <Style x:Key="DetailPageStyle" TargetType="p:DataPage">
        <Setter Property="ControlTemplate">
          <ControlTemplate>
            <StackLayout Spacing="0">
              <ContentPresenter />
              <ListView ItemsSource="{TemplateBinding Data}" ItemTemplate="{TemplateBinding DefaultItemTemplate}" HasUnevenRows="true" />
            </StackLayout>
          </ControlTemplate>
        </Setter>
      </Style>

      <Style TargetType="p:HeroImage">
        <Setter Property="ControlTemplate">
          <ControlTemplate>
            <Grid BackgroundColor="Black" HeightRequest="300">
              <Grid.RowDefinitions>
                <RowDefinition Height="4*" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
              </Grid.RowDefinitions>
              <Image Grid.RowSpan="4" Source="{TemplateBinding ImageSource}" Aspect="{TemplateBinding Aspect}" Opacity="0.6" />
              <Label Grid.Row="1" Margin="25,0,0,0" Text="{TemplateBinding Text}" FontSize="25" TextColor="White" />
              <Label Grid.Row="2" Margin="25,0,0,0" Text="{TemplateBinding Detail}" FontSize="20" TextColor="White" />
            </Grid>
          </ControlTemplate>
        </Setter>
      </Style>

      <DataTemplate x:Key="DetailCell">
        <ViewCell IsEnabled="false">
          <StackLayout Padding="15,5,5,5">
            <Label Text="{Binding Name, Converter={StaticResource capitalizeConverter}}" FontSize="16" />
            <Label Text="{Binding Value}" FontSize="14" TextColor="#444" LineBreakMode="WordWrap" />
          </StackLayout>
        </ViewCell>
      </DataTemplate>

      <DataTemplate x:Key="SpeakerDetailTemplate">
        <local:EventDetailsPage Title="Speaker Details" DataSource="{Binding Value}" Style="{StaticResource DetailPageStyle}" DefaultItemTemplate="{StaticResource DetailCell}" >
          <p:HeroImage Aspect="Fill" Text="{p:DataSourceBinding name}" Detail="{p:DataSourceBinding email}" ImageSource="{p:DataSourceBinding picture}" DataSource="{Binding Value}" />
        </local:EventDetailsPage>
      </DataTemplate>

      <DataTemplate x:Key="EventDetailTemplate">
        <local:EventDetailsPage Title="Event Details" DataSource="{Binding Value}" Style="{StaticResource DetailPageStyle}" DefaultItemTemplate="{StaticResource DetailCell}" >
          <p:HeroImage Aspect="Fill" Text="{p:DataSourceBinding name}" Detail="{p:DataSourceBinding presenter}" ImageSource="{p:DataSourceBinding picture}" DataSource="{Binding Value}" />
        </local:EventDetailsPage>
      </DataTemplate>

    </ResourceDictionary>
  </Application.Resources>
</Application>