|
37 | 37 | xmlns:models="using:LunchScheduler.Models" |
38 | 38 | xmlns:ctCtrls="using:Microsoft.Toolkit.Uwp.UI.Controls" |
39 | 39 | xmlns:root="using:LunchScheduler" |
| 40 | + xmlns:muxc="using:Microsoft.UI.Xaml.Controls" |
40 | 41 | xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
41 | 42 | xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
42 | 43 | mc:Ignorable="d" |
|
69 | 70 | <Style x:Key="CreateRoundButtonStyle" |
70 | 71 | TargetType="AppBarButton" |
71 | 72 | BasedOn="{StaticResource RoundButtonStyle}" /> |
| 73 | + |
| 74 | + <DataTemplate x:Key="LunchItemTemplateFull" x:DataType="models:Lunch"> |
| 75 | + <StackPanel Width="140" |
| 76 | + Height="144" |
| 77 | + Padding="20,12" |
| 78 | + Margin="0,0,0,0"> |
| 79 | + <muxc:PersonPicture DisplayName="{x:Bind Host.Name}" |
| 80 | + ProfilePicture="{x:Bind Host.PhotoUrl, Mode=OneWay}" |
| 81 | + Width="100" /> |
| 82 | + <TextBlock Text="{x:Bind Date, Converter={StaticResource DateStringFormatConverter}, ConverterParameter='g'}" |
| 83 | + Style="{StaticResource BrandCaptionTextStyle}" |
| 84 | + Grid.Row="1" |
| 85 | + HorizontalAlignment="Center" |
| 86 | + VerticalAlignment="Bottom" /> |
| 87 | + </StackPanel> |
| 88 | + </DataTemplate> |
| 89 | + |
| 90 | + <DataTemplate x:Key="LunchItemTemplateSmall" x:DataType="models:Lunch"> |
| 91 | + <StackPanel Width="74" |
| 92 | + Height="144" |
| 93 | + Padding="10,12" |
| 94 | + Margin="0,8,0,0"> |
| 95 | + <muxc:PersonPicture DisplayName="{x:Bind Host.Name}" |
| 96 | + ProfilePicture="{x:Bind Host.PhotoUrl, Mode=OneWay}" |
| 97 | + Width="54" /> |
| 98 | + <TextBlock Text="{x:Bind Date, Converter={StaticResource DateStringFormatConverter}, ConverterParameter='g'}" |
| 99 | + Style="{StaticResource BrandCaptionTextStyle}" |
| 100 | + Grid.Row="1" |
| 101 | + HorizontalAlignment="Center" |
| 102 | + VerticalAlignment="Bottom" /> |
| 103 | + </StackPanel> |
| 104 | + </DataTemplate> |
| 105 | + |
72 | 106 | </ResourceDictionary> |
73 | 107 | </UserControl.Resources> |
74 | 108 |
|
|
82 | 116 | Margin="6,159,6,0"> |
83 | 117 | <Border BorderBrush="Blue" |
84 | 118 | BorderThickness="0,0,0,0" |
85 | | - Height="1" /> |
| 119 | + Height="1"/> |
86 | 120 | </ctCtrls:DropShadowPanel> |
87 | 121 |
|
88 | 122 | <Grid x:Name="rootPanel" |
89 | | - Style="{StaticResource MyLunchesPanelStyle}"> |
| 123 | + Style="{StaticResource MyLunchesPanelStyle}" |
| 124 | + SizeChanged="rootPanel_SizeChanged"> |
90 | 125 | <Grid.ColumnDefinitions> |
91 | 126 | <ColumnDefinition Width="Auto" /> |
92 | 127 | <ColumnDefinition Width="Auto" |
93 | 128 | MaxWidth="200" /> |
94 | 129 | <ColumnDefinition Width="Auto" /> |
95 | | - <ColumnDefinition Width="Auto" /> |
| 130 | + <ColumnDefinition Width="*" /> |
96 | 131 | </Grid.ColumnDefinitions> |
| 132 | + <!-- clock icon --> |
97 | 133 | <!--<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="" Margin="16,0,32,0" Foreground="{ThemeResource BrandPrimaryColorBrush}"/>--> |
98 | | - <FontIcon FontFamily="Segoe MDL2 Assets" |
| 134 | + <FontIcon x:Name="LunchIcon" |
| 135 | + FontFamily="Segoe MDL2 Assets" |
99 | 136 | Glyph="" |
100 | 137 | Margin="16,0,32,0" |
101 | 138 | Foreground="{ThemeResource BrandPrimaryColorBrush}" /> |
|
109 | 146 | FontSize="20" |
110 | 147 | Margin="0" /> |
111 | 148 |
|
112 | | - <GridView x:Name="LunchesList" |
| 149 | + <AppBarButton x:Name="CreateLunchButton" |
| 150 | + Style="{StaticResource CreateRoundButtonStyle}" |
| 151 | + Click="CreateLunch_Click" |
| 152 | + Grid.Column="2" |
| 153 | + VerticalAlignment="Center" |
| 154 | + Label="Create Lunch" |
| 155 | + Icon="Add" |
| 156 | + Width="100" |
| 157 | + Foreground="{ThemeResource BrandPrimaryColorBrush}" |
| 158 | + Margin="40,-20,0,0" /> |
| 159 | + |
| 160 | + <GridView x:Name="LunchesList" Margin="24,8,0,0" |
113 | 161 | ItemsSource="{x:Bind ViewModel.User.Lunches, Mode=OneWay}" |
114 | 162 | SelectionMode="None" |
115 | 163 | IsItemClickEnabled="True" |
| 164 | + ItemTemplate="{StaticResource LunchItemTemplateFull}" |
116 | 165 | ItemClick="LunchesList_ItemClick" |
117 | 166 | Loaded="{x:Bind root:App.ViewModel.UpdateNextLunchText}" |
118 | | - Grid.Column="2"> |
| 167 | + Grid.Column="3" |
| 168 | + ScrollViewer.HorizontalScrollMode="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto" |
| 169 | + ScrollViewer.VerticalScrollMode="Disabled"> |
119 | 170 | <GridView.ItemsPanel> |
120 | 171 | <ItemsPanelTemplate> |
121 | 172 | <ItemsWrapGrid MaximumRowsOrColumns="1" |
122 | 173 | VerticalAlignment="Center" /> |
123 | 174 | </ItemsPanelTemplate> |
124 | 175 | </GridView.ItemsPanel> |
125 | | - <GridView.ItemTemplate> |
126 | | - <DataTemplate x:DataType="models:Lunch"> |
127 | | - <StackPanel Width="140" |
128 | | - Height="144" |
129 | | - Padding="20,12" |
130 | | - Margin="0,8,0,0"> |
131 | | - <PersonPicture DisplayName="{x:Bind Host.Name}" |
132 | | - ProfilePicture="{x:Bind Host.PhotoUrl, Mode=OneWay}" |
133 | | - Width="100" /> |
134 | | - <TextBlock Text="{x:Bind Date, Converter={StaticResource DateStringFormatConverter}, ConverterParameter='g'}" |
135 | | - Style="{StaticResource BrandCaptionTextStyle}" |
136 | | - Grid.Row="1" |
137 | | - HorizontalAlignment="Center" |
138 | | - VerticalAlignment="Bottom" /> |
139 | | - </StackPanel> |
140 | | - </DataTemplate> |
141 | | - </GridView.ItemTemplate> |
142 | 176 | </GridView> |
143 | 177 |
|
144 | | - <AppBarButton Style="{StaticResource CreateRoundButtonStyle}" |
145 | | - Click="CreateLunch_Click" |
146 | | - Grid.Column="3" |
147 | | - VerticalAlignment="Center" |
148 | | - Label="Create Lunch" |
149 | | - Icon="Add" |
150 | | - Width="100" |
151 | | - Foreground="{ThemeResource BrandPrimaryColorBrush}" |
152 | | - Margin="24,0,0,0" /> |
| 178 | + |
153 | 179 | </Grid> |
| 180 | + <VisualStateManager.VisualStateGroups> |
| 181 | + <VisualStateGroup x:Name="SizeStates"> |
| 182 | + <VisualState x:Name="Normal"/> |
| 183 | + <VisualState x:Name="Small"> |
| 184 | + <VisualState.Setters> |
| 185 | + <Setter Target="LunchIcon.Margin" |
| 186 | + Value="16,0"/> |
| 187 | + <Setter Target="NextLunchText.FontSize" Value="14"/> |
| 188 | + <Setter Target="LunchesList.ItemTemplate" |
| 189 | + Value="{StaticResource LunchItemTemplateSmall}"/> |
| 190 | + <Setter Target="LunchesList.Margin" |
| 191 | + Value="0,8,0,0"/> |
| 192 | + <Setter Target="CreateLunchButton.IsCompact" |
| 193 | + Value="True"/> |
| 194 | + <Setter Target="CreateLunchButton.Margin" |
| 195 | + Value="0,16,0,0"/> |
| 196 | + </VisualState.Setters> |
| 197 | + </VisualState> |
| 198 | + </VisualStateGroup> |
| 199 | + </VisualStateManager.VisualStateGroups> |
154 | 200 | </Grid> |
155 | 201 | </UserControl> |
0 commit comments