This commit is contained in:
Jim Walker (WINDOWS) 2020-06-16 10:32:24 -07:00
Родитель 0168e2b3bf
Коммит b5d72206ca
19 изменённых файлов: 437 добавлений и 509 удалений

Просмотреть файл

@ -94,6 +94,11 @@
Value="{StaticResource BrandGridViewItemStyle}" />
</Style>
<ResourceDictionary.MergedDictionaries>
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
<!-- Other merged dictionaries here -->
</ResourceDictionary.MergedDictionaries>
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Light">
<Color x:Key="BrandPrimaryColor">#C83C56</Color>

Просмотреть файл

@ -38,6 +38,7 @@ using LunchScheduler.Repository;
using LunchScheduler.ViewModels;
using Windows.ApplicationModel.Activation;
using Windows.ApplicationModel.Core;
using Windows.Foundation.Metadata;
using Windows.Storage;
using Windows.UI;
using Windows.UI.ViewManagement;
@ -54,7 +55,7 @@ namespace LunchScheduler
{
public static ILunchRepository Api { get; private set; }
public static MainViewModel ViewModel { get; } = new MainViewModel();
public static AuthenticationViewModel AuthenticationViewModel { get; } = new AuthenticationViewModel();
public static AuthenticationViewModel AuthenticationViewModel { get; } = new AuthenticationViewModel();
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code

Просмотреть файл

@ -35,6 +35,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:models="using:LunchScheduler.Models"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
@ -106,7 +107,7 @@
Margin="0,20"
Orientation="Horizontal">
<PersonPicture x:Name="HostIndicator"
<muxc:PersonPicture x:Name="HostIndicator"
Width="48"
Height="48"
VerticalAlignment="Center"
@ -134,7 +135,7 @@
Loaded="FriendsIndicator_Loaded">
<GridView.ItemTemplate>
<DataTemplate x:DataType="models:Invitation">
<PersonPicture ProfilePicture="{x:Bind User.PhotoUrl, Mode=OneWay}"
<muxc:PersonPicture ProfilePicture="{x:Bind User.PhotoUrl, Mode=OneWay}"
DisplayName="{Binding User.Name}"
Width="40"
Height="40"

Просмотреть файл

@ -37,6 +37,7 @@
xmlns:models="using:LunchScheduler.Models"
xmlns:ctCtrls="using:Microsoft.Toolkit.Uwp.UI.Controls"
xmlns:root="using:LunchScheduler"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
@ -69,6 +70,39 @@
<Style x:Key="CreateRoundButtonStyle"
TargetType="AppBarButton"
BasedOn="{StaticResource RoundButtonStyle}" />
<DataTemplate x:Key="LunchItemTemplateFull" x:DataType="models:Lunch">
<StackPanel Width="140"
Height="144"
Padding="20,12"
Margin="0,0,0,0">
<muxc:PersonPicture DisplayName="{x:Bind Host.Name}"
ProfilePicture="{x:Bind Host.PhotoUrl, Mode=OneWay}"
Width="100" />
<TextBlock Text="{x:Bind Date, Converter={StaticResource DateStringFormatConverter}, ConverterParameter='g'}"
Style="{StaticResource BrandCaptionTextStyle}"
Grid.Row="1"
HorizontalAlignment="Center"
VerticalAlignment="Bottom" />
</StackPanel>
</DataTemplate>
<DataTemplate x:Key="LunchItemTemplateSmall" x:DataType="models:Lunch">
<StackPanel Width="74"
Height="144"
Padding="10,12"
Margin="0,8,0,0">
<muxc:PersonPicture DisplayName="{x:Bind Host.Name}"
ProfilePicture="{x:Bind Host.PhotoUrl, Mode=OneWay}"
Width="54" />
<TextBlock Text="{x:Bind Date, Converter={StaticResource DateStringFormatConverter}, ConverterParameter='g'}"
Style="{StaticResource BrandCaptionTextStyle}"
Grid.Row="1"
HorizontalAlignment="Center"
VerticalAlignment="Bottom" />
</StackPanel>
</DataTemplate>
</ResourceDictionary>
</UserControl.Resources>
@ -82,20 +116,23 @@
Margin="6,159,6,0">
<Border BorderBrush="Blue"
BorderThickness="0,0,0,0"
Height="1" />
Height="1"/>
</ctCtrls:DropShadowPanel>
<Grid x:Name="rootPanel"
Style="{StaticResource MyLunchesPanelStyle}">
Style="{StaticResource MyLunchesPanelStyle}"
SizeChanged="rootPanel_SizeChanged">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto"
MaxWidth="200" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<!-- clock icon -->
<!--<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xE121;" Margin="16,0,32,0" Foreground="{ThemeResource BrandPrimaryColorBrush}"/>-->
<FontIcon FontFamily="Segoe MDL2 Assets"
<FontIcon x:Name="LunchIcon"
FontFamily="Segoe MDL2 Assets"
Glyph="&#xE783;"
Margin="16,0,32,0"
Foreground="{ThemeResource BrandPrimaryColorBrush}" />
@ -109,47 +146,56 @@
FontSize="20"
Margin="0" />
<GridView x:Name="LunchesList"
<AppBarButton x:Name="CreateLunchButton"
Style="{StaticResource CreateRoundButtonStyle}"
Click="CreateLunch_Click"
Grid.Column="2"
VerticalAlignment="Center"
Label="Create Lunch"
Icon="Add"
Width="100"
Foreground="{ThemeResource BrandPrimaryColorBrush}"
Margin="40,-20,0,0" />
<GridView x:Name="LunchesList" Margin="24,8,0,0"
ItemsSource="{x:Bind ViewModel.User.Lunches, Mode=OneWay}"
SelectionMode="None"
IsItemClickEnabled="True"
ItemTemplate="{StaticResource LunchItemTemplateFull}"
ItemClick="LunchesList_ItemClick"
Loaded="{x:Bind root:App.ViewModel.UpdateNextLunchText}"
Grid.Column="2">
Grid.Column="3"
ScrollViewer.HorizontalScrollMode="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto"
ScrollViewer.VerticalScrollMode="Disabled">
<GridView.ItemsPanel>
<ItemsPanelTemplate>
<ItemsWrapGrid MaximumRowsOrColumns="1"
VerticalAlignment="Center" />
</ItemsPanelTemplate>
</GridView.ItemsPanel>
<GridView.ItemTemplate>
<DataTemplate x:DataType="models:Lunch">
<StackPanel Width="140"
Height="144"
Padding="20,12"
Margin="0,8,0,0">
<PersonPicture DisplayName="{x:Bind Host.Name}"
ProfilePicture="{x:Bind Host.PhotoUrl, Mode=OneWay}"
Width="100" />
<TextBlock Text="{x:Bind Date, Converter={StaticResource DateStringFormatConverter}, ConverterParameter='g'}"
Style="{StaticResource BrandCaptionTextStyle}"
Grid.Row="1"
HorizontalAlignment="Center"
VerticalAlignment="Bottom" />
</StackPanel>
</DataTemplate>
</GridView.ItemTemplate>
</GridView>
<AppBarButton Style="{StaticResource CreateRoundButtonStyle}"
Click="CreateLunch_Click"
Grid.Column="3"
VerticalAlignment="Center"
Label="Create Lunch"
Icon="Add"
Width="100"
Foreground="{ThemeResource BrandPrimaryColorBrush}"
Margin="24,0,0,0" />
</Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="SizeStates">
<VisualState x:Name="Normal"/>
<VisualState x:Name="Small">
<VisualState.Setters>
<Setter Target="LunchIcon.Margin"
Value="16,0"/>
<Setter Target="NextLunchText.FontSize" Value="14"/>
<Setter Target="LunchesList.ItemTemplate"
Value="{StaticResource LunchItemTemplateSmall}"/>
<Setter Target="LunchesList.Margin"
Value="0,8,0,0"/>
<Setter Target="CreateLunchButton.IsCompact"
Value="True"/>
<Setter Target="CreateLunchButton.Margin"
Value="0,16,0,0"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</UserControl>

Просмотреть файл

@ -48,9 +48,34 @@ namespace LunchScheduler.CustomControls
public string GreetingString = String.Empty;
double RequiredGridWidthNormal = 0.0;
bool IsNormalState = true;
double AvailableGridSpace = 0.0;
double GridAdjustmentSize = 0.0;
public MyLunches()
{
this.InitializeComponent();
ViewModel.User.Lunches.CollectionChanged += Lunches_CollectionChanged;
Loaded += MyLunches_Loaded;
}
private void MyLunches_Loaded(object sender, RoutedEventArgs e)
{
// This should only be set once, while the items are in their Normal state.
if (GridAdjustmentSize == 0.0)
{
GridAdjustmentSize = LunchIcon.ActualWidth + LunchIcon.Margin.Left + LunchIcon.Margin.Right +
NextLunchText.ActualWidth + NextLunchText.Margin.Left + NextLunchText.Margin.Right +
CreateLunchButton.ActualWidth + CreateLunchButton.Margin.Left + CreateLunchButton.Margin.Right +
LunchesList.Margin.Left + LunchesList.Margin.Right;
}
AvailableGridSpace = rootPanel.ActualWidth - GridAdjustmentSize;
RequiredGridWidthNormal = 140 * LunchesList.Items.Count;
UpdateItemSize();
}
private void CreateLunch_Click(object sender, RoutedEventArgs e)
@ -103,5 +128,31 @@ namespace LunchScheduler.CustomControls
}
}
}
private void Lunches_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
RequiredGridWidthNormal = 140 * LunchesList.Items.Count;
UpdateItemSize();
}
private void UpdateItemSize()
{
if (IsNormalState == true && AvailableGridSpace < RequiredGridWidthNormal)
{
VisualStateManager.GoToState(this, "Small", true);
IsNormalState = false;
}
else if (IsNormalState == false && AvailableGridSpace > RequiredGridWidthNormal)
{
VisualStateManager.GoToState(this, "Normal", true);
IsNormalState = true;
}
}
private void rootPanel_SizeChanged(object sender, SizeChangedEventArgs e)
{
AvailableGridSpace = e.NewSize.Width - GridAdjustmentSize;
UpdateItemSize();
}
}
}

Просмотреть файл

@ -40,6 +40,7 @@
xmlns:behaviors="using:Microsoft.Toolkit.Uwp.UI.Animations.Behaviors"
xmlns:core="using:Microsoft.Xaml.Interactions.Core"
xmlns:models="using:LunchScheduler.Models"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
@ -53,284 +54,10 @@
<Setter Property="BorderThickness" Value="1"/>
</Style>
<!-- The primary reason for re-templating the buttons is to
set the CornerRadius to match the ends of the Grid. -->
<Style x:Key="EndToggleButtonStyle" TargetType="ToggleButton">
<Setter Property="Background" Value="{ThemeResource ToggleButtonBackground}"/>
<Setter Property="Foreground" Value="{ThemeResource ToggleButtonForeground}"/>
<Setter Property="BorderBrush" Value="{ThemeResource ToggleButtonBorderBrush}"/>
<Setter Property="BorderThickness" Value="{ThemeResource ToggleButtonBorderThemeThickness}"/>
<Setter Property="Padding" Value="8,4,8,4"/>
<Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="VerticalAlignment" Value="Stretch"/>
<Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}"/>
<Setter Property="FontWeight" Value="Normal"/>
<Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}"/>
<Setter Property="UseSystemFocusVisuals" Value="True"/>
<Setter Property="FocusVisualMargin" Value="-3"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Grid x:Name="RootGrid" Background="{TemplateBinding Background}" CornerRadius="0,12,12,0">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal">
<Storyboard>
<PointerUpThemeAnimation Storyboard.TargetName="RootGrid"/>
</Storyboard>
</VisualState>
<VisualState x:Name="PointerOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="RootGrid">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonBackgroundPointerOver}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonBorderBrushPointerOver}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonForegroundPointerOver}"/>
</ObjectAnimationUsingKeyFrames>
<PointerUpThemeAnimation Storyboard.TargetName="RootGrid"/>
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="RootGrid">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonBackgroundPressed}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonBorderBrushPressed}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonForegroundPressed}"/>
</ObjectAnimationUsingKeyFrames>
<PointerDownThemeAnimation Storyboard.TargetName="RootGrid"/>
</Storyboard>
</VisualState>
<VisualState x:Name="Disabled">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="RootGrid">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonBackgroundDisabled}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonForegroundDisabled}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonBorderBrushDisabled}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Checked">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="RootGrid">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonBackgroundChecked}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonForegroundChecked}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonBorderBrushChecked}"/>
</ObjectAnimationUsingKeyFrames>
<PointerUpThemeAnimation Storyboard.TargetName="RootGrid"/>
</Storyboard>
</VisualState>
<VisualState x:Name="CheckedPointerOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="RootGrid">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonBackgroundCheckedPointerOver}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonBorderBrushCheckedPointerOver}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonForegroundCheckedPointerOver}"/>
</ObjectAnimationUsingKeyFrames>
<PointerUpThemeAnimation Storyboard.TargetName="RootGrid"/>
</Storyboard>
</VisualState>
<VisualState x:Name="CheckedPressed">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="RootGrid">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonBackgroundCheckedPressed}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonForegroundCheckedPressed}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonBorderBrushCheckedPressed}"/>
</ObjectAnimationUsingKeyFrames>
<PointerDownThemeAnimation Storyboard.TargetName="RootGrid"/>
</Storyboard>
</VisualState>
<VisualState x:Name="CheckedDisabled">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="RootGrid">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonBackgroundCheckedDisabled}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonForegroundCheckedDisabled}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonBorderBrushCheckedDisabled}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Indeterminate">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="RootGrid">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonBackgroundIndeterminate}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonForegroundIndeterminate}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonBorderBrushIndeterminate}"/>
</ObjectAnimationUsingKeyFrames>
<PointerUpThemeAnimation Storyboard.TargetName="RootGrid"/>
</Storyboard>
</VisualState>
<VisualState x:Name="IndeterminatePointerOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="RootGrid">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonBackgroundIndeterminatePointerOver}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonBorderBrushIndeterminatePointerOver}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonForegroundIndeterminatePointerOver}"/>
</ObjectAnimationUsingKeyFrames>
<PointerUpThemeAnimation Storyboard.TargetName="RootGrid"/>
</Storyboard>
</VisualState>
<VisualState x:Name="IndeterminatePressed">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="RootGrid">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonBackgroundIndeterminatePressed}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonBorderBrushIndeterminatePressed}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonForegroundIndeterminatePressed}"/>
</ObjectAnimationUsingKeyFrames>
<PointerDownThemeAnimation Storyboard.TargetName="RootGrid"/>
</Storyboard>
</VisualState>
<VisualState x:Name="IndeterminateDisabled">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="RootGrid">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonBackgroundIndeterminateDisabled}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonForegroundIndeterminateDisabled}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonBorderBrushIndeterminateDisabled}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<ContentPresenter x:Name="ContentPresenter"
AutomationProperties.AccessibilityView="Raw"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
ContentTemplate="{TemplateBinding ContentTemplate}"
ContentTransitions="{TemplateBinding ContentTransitions}"
Content="{TemplateBinding Content}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
Padding="{TemplateBinding Padding}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="EndButtonStyle" TargetType="Button">
<Setter Property="Background" Value="{ThemeResource ButtonBackground}"/>
<Setter Property="Foreground" Value="{ThemeResource ButtonForeground}"/>
<Setter Property="BorderBrush" Value="{ThemeResource ButtonBorderBrush}"/>
<Setter Property="BorderThickness" Value="{ThemeResource ButtonBorderThemeThickness}"/>
<Setter Property="Padding" Value="8,4,8,4"/>
<Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="VerticalAlignment" Value="Stretch"/>
<Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}"/>
<Setter Property="FontWeight" Value="Normal"/>
<Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}"/>
<Setter Property="UseSystemFocusVisuals" Value="True"/>
<Setter Property="FocusVisualMargin" Value="-3"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid x:Name="RootGrid" Background="{TemplateBinding Background}"
CornerRadius="11,0,0,11">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal">
<Storyboard>
<PointerUpThemeAnimation Storyboard.TargetName="RootGrid"/>
</Storyboard>
</VisualState>
<VisualState x:Name="PointerOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="RootGrid">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonBackgroundPointerOver}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonBorderBrushPointerOver}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonForegroundPointerOver}"/>
</ObjectAnimationUsingKeyFrames>
<PointerUpThemeAnimation Storyboard.TargetName="RootGrid"/>
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="RootGrid">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonBackgroundPressed}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonBorderBrushPressed}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonForegroundPressed}"/>
</ObjectAnimationUsingKeyFrames>
<PointerDownThemeAnimation Storyboard.TargetName="RootGrid"/>
</Storyboard>
</VisualState>
<VisualState x:Name="Disabled">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="RootGrid">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonBackgroundDisabled}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonBorderBrushDisabled}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonForegroundDisabled}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<ContentPresenter x:Name="ContentPresenter"
AutomationProperties.AccessibilityView="Raw"
CornerRadius="12,0,0,12"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
ContentTemplate="{TemplateBinding ContentTemplate}"
ContentTransitions="{TemplateBinding ContentTransitions}"
Content="{TemplateBinding Content}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
Padding="{TemplateBinding Padding}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="CornerRadius" Value="11,0,0,11"/>
</Style>
</UserControl.Resources>
@ -380,23 +107,23 @@
<SolidColorBrush x:Key="ButtonForegroundPointerOverPressed" Color="#000000"/>
</Grid.Resources>
<Button Click="AcceptButton_Click"
Style="{StaticResource EndButtonStyle}">
<Button Click="AcceptButton_Click"
Style="{StaticResource EndButtonStyle}">
<Button.Content>
<SymbolIcon Symbol="Accept"/>
</Button.Content>
</Button>
<TextBlock x:Name="AcceptText" Text="Accept"
Grid.Column="1"
VerticalAlignment="Center"
Margin="12,0,0,0"/>
Grid.Column="1"
VerticalAlignment="Center"
Margin="12,0,0,0"/>
</Grid>
<Grid x:Name="DeclineRoot"
Grid.Row="1" VerticalAlignment="Bottom"
Style="{StaticResource ButtonGridStyle}"
BorderBrush="#99E53F00">
Grid.Row="1" VerticalAlignment="Bottom"
Style="{StaticResource ButtonGridStyle}"
BorderBrush="#99E53F00">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="48"/>
<ColumnDefinition Width="*"/>
@ -432,16 +159,16 @@
</Grid.Resources>
<Button Click="DeclineButton_Click"
Style="{StaticResource EndButtonStyle}">
Style="{StaticResource EndButtonStyle}">
<Button.Content>
<SymbolIcon Symbol="Cancel"/>
</Button.Content>
</Button>
<TextBlock x:Name="DeclineText" Text="Decline"
Grid.Column="1"
VerticalAlignment="Center"
Margin="12,0,0,0" />
Grid.Column="1"
VerticalAlignment="Center"
Margin="12,0,0,0" />
</Grid>
</Grid>
@ -518,7 +245,7 @@
<GridView.ItemTemplate>
<DataTemplate x:DataType="models:Invitation">
<StackPanel Width="100" Height="100">
<PersonPicture x:Name="PPC" DisplayName="{x:Bind User.Name, Mode=OneWay}" Width="60"
<muxc:PersonPicture x:Name="PPC" DisplayName="{x:Bind User.Name, Mode=OneWay}" Width="60"
ProfilePicture="{x:Bind User.PhotoUrl, Mode=OneWay}"
BadgeGlyph="{x:Bind Response, Mode=OneWay, Converter={StaticResource StateToGlyphConverter}}"/>
<TextBlock Text="{x:Bind User.Name}" Style="{StaticResource BrandCaptionTextStyle}" Grid.Row="1"
@ -550,7 +277,7 @@
</Button>
</StackPanel>
</RelativePanel>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState>
@ -642,7 +369,7 @@
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="DeclineRoot">
<DiscreteObjectKeyFrame KeyTime="0" Value="#E53F00"/>
</ObjectAnimationUsingKeyFrames>
<!-- These are settings we would use if we weren't using composition animations to show and hide content. -->
<!--<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="HeaderTextBlock">
<DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
@ -671,7 +398,5 @@
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</UserControl>

Просмотреть файл

@ -11,7 +11,7 @@
<AssemblyName>LunchScheduler</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.19569.0</TargetPlatformVersion>
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.19041.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>
@ -273,6 +273,9 @@
<PackageReference Include="Microsoft.Toolkit.Uwp.UI.Controls">
<Version>5.1.1</Version>
</PackageReference>
<PackageReference Include="Microsoft.UI.Xaml">
<Version>2.4.2</Version>
</PackageReference>
<PackageReference Include="NETStandard.Library">
<Version>2.0.3</Version>
</PackageReference>

Просмотреть файл

@ -37,6 +37,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:models="using:LunchScheduler.Models"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
mc:Ignorable="d">
<Page.Resources>
<Style x:Key="ListViewItemNormal"
@ -163,7 +164,7 @@
</FlyoutBase.AttachedFlyout>
</HyperlinkButton>
<PersonPicture x:Name="UserPicture"
<muxc:PersonPicture x:Name="UserPicture"
Width="24"
Height="24"
ProfilePicture="{x:Bind ViewModel.User.PhotoUrl, Mode=OneWay}"
@ -176,7 +177,7 @@
Click="MenuFlyoutItem_Click" />
</MenuFlyout>
</FlyoutBase.AttachedFlyout>
</PersonPicture>
</muxc:PersonPicture>
</Grid>

Просмотреть файл

@ -55,6 +55,10 @@
<!-- Round style for Windows.UI.Xaml.Controls.AppBarButton -->
<Style x:Key="RoundButtonStyle"
TargetType="AppBarButton">
<Setter Property="Width"
Value="100"/>
<Setter Property="Height"
Value="100"/>
<Setter Property="Foreground"
Value="{ThemeResource AppBarItemForegroundThemeBrush}" />
<Setter Property="Background"
@ -183,13 +187,13 @@
HorizontalAlignment="Center">
<Ellipse x:Name="BackgroundEllipse"
UseLayoutRounding="False"
Width="100"
Height="100"
Width="{TemplateBinding Width}"
Height="{TemplateBinding Height}"
Fill="{ThemeResource AppBarItemBackgroundThemeBrush}" />
<Ellipse x:Name="OutlineEllipse"
UseLayoutRounding="False"
Width="100"
Height="100"
Width="{TemplateBinding Width}"
Height="{TemplateBinding Height}"
Stroke="{ThemeResource AppBarItemBorderThemeBrush}"
StrokeThickness="2" />
<ContentPresenter x:Name="Content"

Просмотреть файл

@ -36,6 +36,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ctCtrls="using:Microsoft.Toolkit.Uwp.UI.Controls"
xmlns:models="using:LunchScheduler.Models"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
@ -165,7 +166,7 @@
VerticalAlignment="Top"
ScrollViewer.HorizontalScrollMode="Disabled">
<PersonPicture x:Name="HostIndicator"
<muxc:PersonPicture x:Name="HostIndicator"
Width="48"
Height="48"
VerticalAlignment="Center"

Просмотреть файл

@ -49,6 +49,7 @@ namespace LunchScheduler.Views
public MainViewModel ViewModel => App.ViewModel;
private int progressIndicatorOffset = 252;
//private int progressIndicatorOffset = 0;
public CreateLunchPage()
{

Просмотреть файл

@ -37,6 +37,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:models="using:LunchScheduler.Models"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
mc:Ignorable="d"
NavigationCacheMode="Enabled">
<Page.Resources>
@ -53,7 +54,7 @@
Padding="20,12"
Margin="0,8,0,0"
ContextFlyout="{StaticResource InviteMenuFlyout}">
<PersonPicture DisplayName="{x:Bind Name, Mode=OneWay}"
<muxc:PersonPicture DisplayName="{x:Bind Name, Mode=OneWay}"
Width="100"
ProfilePicture="{x:Bind PhotoUrl, Mode=OneWay}"
FlyoutBase.AttachedFlyout="{StaticResource InviteMenuFlyout}"
@ -67,6 +68,13 @@
TextWrapping="NoWrap" />
</StackPanel>
</DataTemplate>
<Style x:Key="GridView_DefaultItemContainerStyle"
TargetType="GridViewItem">
<Setter Property="Margin" x:Name="GridItemMarginSetter"
Value="0" />
</Style>
</Page.Resources>
<Grid Margin="24,24,0,0">
@ -83,7 +91,8 @@
Style="{StaticResource PersonPictureGridStyle}"
ItemsSource="{x:Bind ViewModel.User.Friends, Mode=OneWay}"
ItemTemplate="{StaticResource UserDataTemplate}"
SelectionChanged="FriendsList_SelectionChanged">
SelectionChanged="FriendsList_SelectionChanged"
ItemContainerStyle="{StaticResource GridView_DefaultItemContainerStyle}">
<GridView.HeaderTemplate>
<DataTemplate>
<TextBlock Margin="0,0,0,8"
@ -107,7 +116,7 @@
Height="144"
Padding="20,12"
Margin="0,8,0,0">
<PersonPicture DisplayName="Gaming friends"
<muxc:PersonPicture DisplayName="Gaming friends"
BadgeGlyph="&#xE7FC;"
Width="100"
ProfilePicture="{x:Bind ViewModel.User.PhotoUrl, Mode=OneWay}" />
@ -123,7 +132,7 @@
Height="144"
Padding="20,12"
Margin="0,8,0,0">
<PersonPicture DisplayName="Carpool"
<muxc:PersonPicture DisplayName="Carpool"
BadgeGlyph="&#xE811;"
Width="100"
ProfilePicture="{x:Bind ViewModel.User.PhotoUrl, Mode=OneWay}" />
@ -139,7 +148,7 @@
Height="144"
Padding="20,12"
Margin="0,8,0,0">
<PersonPicture DisplayName="Garden club"
<muxc:PersonPicture DisplayName="Garden club"
BadgeGlyph="&#xEC0A;"
Width="100"
ProfilePicture="{x:Bind ViewModel.User.PhotoUrl, Mode=OneWay}" />

Просмотреть файл

@ -31,10 +31,43 @@
// sell, market, or promote the Microsoft Images.
// ---------------------------------------------------------------------------------
using System.Collections.Generic;
// ---------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// The MIT License (MIT)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
// Microsoft License for use of Images
//
// Microsoft grants you a worldwide, non-exclusive, non-transferrable, revocable,
// royalty-free license to use the Microsoft photographs or images contained in this
// Microsoft sample project, Lunch Scheduler, (“Images”) solely for your purposes
// of internal using or testing the sample application.You may not copy, modify,
// reproduce, distribute, publicly display, offer for sale,
// sell, market, or promote the Microsoft Images.
// ---------------------------------------------------------------------------------
using LunchScheduler.Common;
using LunchScheduler.Models;
using LunchScheduler.ViewModels;
using System.Collections.Generic;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
@ -58,7 +91,7 @@ namespace LunchScheduler.Views
if (e.NavigationMode == NavigationMode.New)
{
var user = e.Parameter as User;
if (user != null)
{
FriendsList.SelectedItem = user;
@ -115,7 +148,6 @@ namespace LunchScheduler.Views
if (!FriendsList.SelectedItems.Contains(user))
{
FriendsList.SelectedItems.Add(user);
//ViewModel.LunchBeingCreated.Invitations.Add(new Invitation(ViewModel.LunchBeingCreated, user));
}
}
else

Просмотреть файл

@ -35,6 +35,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ctCtrls="using:Microsoft.Toolkit.Uwp.UI.Controls"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:toolkitConverters="using:Microsoft.Toolkit.Uwp.UI.Converters"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
@ -57,11 +58,11 @@
<RowDefinition />
</Grid.RowDefinitions>
<PersonPicture x:Name="LoginPicture"
<muxc:PersonPicture x:Name="LoginPicture"
Grid.Row="1" />
<StackPanel Grid.Row="2">
<ProgressRing x:Name="LoginProgress"
<muxc:ProgressRing x:Name="LoginProgress"
IsActive="{x:Bind ViewModel.IsLoggingIn, Mode=OneWay}"
Foreground="#57AF57"
Margin="0,0,0,24"

Просмотреть файл

@ -35,6 +35,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ctrls="using:LunchScheduler.CustomControls"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
xmlns:models="using:LunchScheduler.Models"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
@ -70,20 +71,24 @@
Margin="0,0,24,0" />
<ScrollViewer Grid.Row="1">
<RelativePanel>
<Grid Margin="0,44,0,0"
<muxc:TwoPaneView Pane1Length="*" Pane2Length="*"
MinTallModeHeight="0"
MinWideModeWidth="Infinity">
<muxc:TwoPaneView.Pane1>
<RelativePanel>
<Grid Margin="0,44,0,0"
x:Name="AwaitingResponseRoot"
RelativePanel.AlignLeftWithPanel="True">
<Grid.RowDefinitions>
<RowDefinition Height="26" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="26" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Text="Awaiting response"
<TextBlock Text="Awaiting response"
Style="{StaticResource BrandListHeaderTextStyle}"
Margin="0,0,0,0" />
<TextBlock x:Name="NoInvitesText"
<TextBlock x:Name="NoInvitesText"
Text="You don't have any new invitations to respond to."
Foreground="{ThemeResource BrandPrimaryColorBrush}"
Grid.Row="1"
@ -93,7 +98,7 @@
Margin="0"
Visibility="Collapsed" />
<GridView x:Name="AwaitingResponse"
<GridView x:Name="AwaitingResponse"
Grid.Row="1"
ItemsSource="{x:Bind ViewModel.User.Invitations}"
IsItemClickEnabled="False"
@ -104,34 +109,34 @@
SelectionChanged="AwaitingResponse_SelectionChanged"
SelectedIndex="-1"
ItemContainerStyle="{StaticResource BrandGridViewItemStyle}">
<GridView.ItemTemplate>
<DataTemplate x:DataType="models:Invitation">
<StackPanel Width="140"
<GridView.ItemTemplate>
<DataTemplate x:DataType="models:Invitation">
<StackPanel Width="140"
Height="144"
Padding="20,12"
Margin="0,8,0,0">
<PersonPicture DisplayName="{x:Bind User.Name, Mode=OneWay}"
<PersonPicture DisplayName="{x:Bind User.Name, Mode=OneWay}"
Width="100"
ProfilePicture="{x:Bind Lunch.Host.PhotoUrl, Mode=OneWay}"
BadgeGlyph="{x:Bind Response, Mode=OneWay, Converter={StaticResource StateToGlyphConverter}}"
ToolTipService.ToolTip="{x:Bind User.Name, Mode=OneWay}" />
<TextBlock Text="{x:Bind Lunch.Date, Converter={StaticResource DateStringFormatConverter}, ConverterParameter='g'}"
<TextBlock Text="{x:Bind Lunch.Date, Converter={StaticResource DateStringFormatConverter}, ConverterParameter='g'}"
Style="{StaticResource BrandCaptionTextStyle}"
Grid.Row="1"
HorizontalAlignment="Center"
VerticalAlignment="Bottom" />
</StackPanel>
</DataTemplate>
</GridView.ItemTemplate>
<GridView.ItemsPanel>
<ItemsPanelTemplate>
<ItemsWrapGrid MaximumRowsOrColumns="1" />
</ItemsPanelTemplate>
</GridView.ItemsPanel>
</GridView>
</Grid>
</StackPanel>
</DataTemplate>
</GridView.ItemTemplate>
<GridView.ItemsPanel>
<ItemsPanelTemplate>
<ItemsWrapGrid MaximumRowsOrColumns="1" />
</ItemsPanelTemplate>
</GridView.ItemsPanel>
</GridView>
</Grid>
<Grid x:Name="ResponseGrid"
<Grid x:Name="ResponseGrid"
Background="#88FFFFFF"
Padding="56,36,0,36"
Margin="-24,0,24,0"
@ -142,33 +147,39 @@
RelativePanel.AlignRightWithPanel="True"
Visibility="Collapsed"
DataContext="{x:Bind AwaitingResponse.SelectedItem, Mode=OneWay}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<ctrls:ResponsePane />
</Grid>
<ctrls:ResponsePane />
</Grid>
<Grid Margin="0,44,0,0"
<Grid Margin="0,44,0,0"
RelativePanel.Below="ResponseGrid"
RelativePanel.AlignLeftWithPanel="True"
RelativePanel.AlignRightWithPanel="True">
<Grid.RowDefinitions>
<RowDefinition Height="26" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="26" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock Text="My Invitations"
</Grid>
</RelativePanel>
</muxc:TwoPaneView.Pane1>
<muxc:TwoPaneView.Pane2>
<Grid x:Name="Pane2Root" Margin="24,44,0,0">
<TextBlock Text="My Invitations"
Grid.ColumnSpan="2"
Style="{StaticResource BrandListHeaderTextStyle}"
Margin="0,0,0,0" />
<!--<AppBarButton Style="{StaticResource CreateRoundButtonStyle}"
<!--<AppBarButton Style="{StaticResource CreateRoundButtonStyle}"
Click="CreateLunch_Click"
Grid.Row="1"
VerticalAlignment="Top"
@ -177,7 +188,7 @@
Width="100"
Margin="21,20,23,0" />-->
<GridView ItemsSource="{x:Bind MyInvitationsCVS.View}"
<GridView ItemsSource="{x:Bind MyInvitationsCVS.View}"
Grid.Column="1"
Grid.Row="1"
ItemContainerStyle="{StaticResource BrandGridViewItemStyle}"
@ -188,47 +199,49 @@
SelectedIndex="-1"
IsItemClickEnabled="False"
SelectionMode="None">
<GridView.ItemTemplate>
<DataTemplate x:DataType="models:Invitation">
<StackPanel Width="140"
<GridView.ItemTemplate>
<DataTemplate x:DataType="models:Invitation">
<StackPanel Width="140"
Height="144"
Padding="20,12"
Margin="0,8,0,0">
<PersonPicture DisplayName="{x:Bind User.Name, Mode=OneWay}"
<PersonPicture DisplayName="{x:Bind User.Name, Mode=OneWay}"
Width="100"
ProfilePicture="{x:Bind User.PhotoUrl, Mode=OneWay}"
BadgeGlyph="{x:Bind Response, Mode=OneWay, Converter={StaticResource StateToGlyphConverter}}" />
<TextBlock Text="{x:Bind User.Name}"
<TextBlock Text="{x:Bind User.Name}"
Style="{StaticResource BrandCaptionTextStyle}"
Grid.Row="1"
HorizontalAlignment="Center"
VerticalAlignment="Bottom"/>
</StackPanel>
</DataTemplate>
</GridView.ItemTemplate>
<GridView.GroupStyle>
<GroupStyle>
<GroupStyle.HeaderTemplate>
<DataTemplate x:DataType="models:Lunch">
<StackPanel Orientation="Horizontal" Margin="0,24,0,0">
<TextBlock Text="Lunch:" Margin="0,0,8,0"
</StackPanel>
</DataTemplate>
</GridView.ItemTemplate>
<GridView.GroupStyle>
<GroupStyle>
<GroupStyle.HeaderTemplate>
<DataTemplate x:DataType="models:Lunch">
<StackPanel Orientation="Horizontal" Margin="0,24,0,0">
<TextBlock Text="Lunch:" Margin="0,0,8,0"
Style="{StaticResource BodyTextBlockStyle}"/>
<TextBlock Text="{Binding Date, Converter={StaticResource DateStringFormatConverter}, ConverterParameter='d', Mode=OneWay}"
<TextBlock Text="{Binding Date, Converter={StaticResource DateStringFormatConverter}, ConverterParameter='d', Mode=OneWay}"
Style="{StaticResource BodyTextBlockStyle}"
Margin="0,0,8,0"/>
<TextBlock Text="{x:Bind Date.TimeOfDay, Converter={StaticResource DateStringFormatConverter}, ConverterParameter='t', Mode=OneWay}"
<TextBlock Text="{x:Bind Date.TimeOfDay, Converter={StaticResource DateStringFormatConverter}, ConverterParameter='t', Mode=OneWay}"
Style="{StaticResource BodyTextBlockStyle}"
Margin="0,0,8,0"/>
<TextBlock Text="{x:Bind Location.Name, Mode=OneWay}"
<TextBlock Text="{x:Bind Location.Name, Mode=OneWay}"
Style="{StaticResource BodyTextBlockStyle}"/>
</StackPanel>
</DataTemplate>
</GroupStyle.HeaderTemplate>
</GroupStyle>
</GridView.GroupStyle>
</GridView>
</Grid>
</RelativePanel>
</StackPanel>
</DataTemplate>
</GroupStyle.HeaderTemplate>
</GroupStyle>
</GridView.GroupStyle>
</GridView>
</Grid>
</muxc:TwoPaneView.Pane2>
</muxc:TwoPaneView>
</ScrollViewer>
<VisualStateManager.VisualStateGroups>

Просмотреть файл

@ -37,6 +37,7 @@
xmlns:models="using:LunchScheduler.Models"
xmlns:devTools="using:Microsoft.Toolkit.Uwp.DeveloperTools"
xmlns:ctrls="using:LunchScheduler.CustomControls"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
@ -55,7 +56,7 @@
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<devTools:AlignmentGrid Opacity="0"
<devTools:AlignmentGrid Opacity="0" Grid.RowSpan="2"
LineBrush="Black"
HorizontalStep="4"
VerticalStep="4" />
@ -66,7 +67,7 @@
<ScrollViewer Grid.Row="1">
<RelativePanel>
<Grid x:Name="LunchinFriends"
RelativePanel.AlignLeftWithPanel="True">
RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
@ -88,7 +89,7 @@
Height="144"
Padding="20,12"
Margin="0,8,0,0">
<PersonPicture DisplayName="{x:Bind Name, Mode=OneWay}"
<muxc:PersonPicture DisplayName="{x:Bind Name, Mode=OneWay}"
Width="100"
ProfilePicture="{x:Bind PhotoUrl, Mode=OneWay}" />
<TextBlock Text="{x:Bind Name}"
@ -120,7 +121,7 @@
</Grid>
<Grid RelativePanel.Below="LunchinFriends"
RelativePanel.AlignLeftWithPanel="True">
RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
@ -157,7 +158,7 @@
Width="140"
Height="92"
Stretch="Fill" />
<RatingControl MaxRating="5"
<muxc:RatingControl MaxRating="5"
Value="{x:Bind Rating}"
IsReadOnly="True"
VerticalAlignment="Bottom" />

Просмотреть файл

@ -61,5 +61,38 @@ namespace LunchScheduler.Views
{
NavigationService.Navigate(typeof(PlacesPage));
}
//private void TwoPaneView_ModeChanged(TwoPaneView sender, object args)
//{
// // Remove details content from it's parent panel.
// ((Panel)RestaurantsGrid.Parent).Children.Remove(RestaurantsGrid);
// // Set Normal visual state.
// //Windows.UI.Xaml.VisualStateManager.GoToState(this, "Normal", true);
// // Single pane
// if (sender.Mode == TwoPaneViewMode.SinglePane)
// {
// // Add the details content to Pane1.
// Pane1Root.Children.Add(RestaurantsGrid);
// }
// // Dual pane.
// else
// {
// // Put details content in Pane2.
// Pane2Root.Children.Add(RestaurantsGrid);
// // If also in Wide mode, set Wide visual state
// // to constrain the width of the image to 2*.
// //if (sender.Mode == Microsoft.UI.Xaml.Controls.TwoPaneViewMode.Wide)
// //{
// // Windows.UI.Xaml.VisualStateManager.GoToState(this, "Wide", true);
// //}
// }
//}
private void TwoPaneView_ModeChanged(Microsoft.UI.Xaml.Controls.TwoPaneView sender, object args)
{
var m = sender.Mode;
}
}
}

Просмотреть файл

@ -38,34 +38,24 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:maps="using:Windows.UI.Xaml.Controls.Maps"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
xmlns:vm="using:LunchScheduler.ViewModels"
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
xmlns:ctCtrls="using:Microsoft.Toolkit.Uwp.UI.Controls"
mc:Ignorable="d"
NavigationCacheMode="Enabled">
<Page.Resources>
<!--<SolidColorBrush x:Key="ListViewItemForeground" Color="#99FFFFFF"/>
<SolidColorBrush x:Key="ListViewItemForegroundSelected" Color="White"/>
<SolidColorBrush x:Key="ListViewItemForegroundPointerOver" Color="White"/>
<SolidColorBrush x:Key="ListViewItemBackgroundSelected" Color="#F4F4F4"/>
<SolidColorBrush x:Key="ListViewItemBackgroundSelectedPointerOver" Color="#F2F2F2"/>
<SolidColorBrush x:Key="ListViewItemBackgroundSelectedPressed" Color="Transparent"/>-->
</Page.Resources>
<Grid Margin="24,24,24,0"
ScrollViewer.VerticalScrollMode="Disabled">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="684" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<muxc:TwoPaneView Pane1Length="2*" MinWideModeWidth="959">
<muxc:TwoPaneView.Pane1>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<AutoSuggestBox Header="Search (Disabled for Demo mode.)"
<AutoSuggestBox Header="Search (Disabled for Demo mode.)"
PlaceholderText="One Microsoft Way, Redmond, WA"
QueryIcon="Find"
Text="{x:Bind ViewModel.SearchAddress, Mode=OneWay}"
@ -74,85 +64,86 @@
HorizontalAlignment="Left"
IsEnabled="{x:Bind models:Constants.IsNotDemoMode}" />
<ListView x:Name="RestaurantList"
<ListView x:Name="RestaurantList"
ItemsSource="{x:Bind ViewModel.Restaurants}"
SelectionMode="Single"
Grid.Row="2"
SelectedItem="{x:Bind ViewModel.SelectedRestaurant, Mode=TwoWay}"
ContainerContentChanging="RestaurantList_ContainerContentChanging">
<ListView.ItemTemplate>
<DataTemplate x:DataType="models:Restaurant">
<Grid Margin="0,8"
<ListView.ItemTemplate>
<DataTemplate x:DataType="models:Restaurant">
<Grid Margin="0,8"
Width="660">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="32" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="32" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<!-- Warning: This TextBlock is used in the ContainerContentChanging handler.
<!-- Warning: This TextBlock is used in the ContainerContentChanging handler.
It needs to be the first child of the Grid. If it moves, the code needs
to be updated. -->
<TextBlock Style="{StaticResource BodyTextBlockStyle}"
Foreground="#999999"
VerticalAlignment="Center" />
<TextBlock Style="{StaticResource BodyTextBlockStyle}"
Foreground="#999999"
VerticalAlignment="Center" />
<Image Source="{x:Bind PhotoUrl}"
Width="148"
Height="100"
Stretch="UniformToFill"
Grid.Column="1" />
<Image Source="{x:Bind PhotoUrl}"
Width="148"
Height="100"
Stretch="UniformToFill"
Grid.Column="1" />
<StackPanel Grid.Column="2"
<StackPanel Grid.Column="2"
Margin="16,0">
<TextBlock Text="{x:Bind Name}"
<TextBlock Text="{x:Bind Name}"
Style="{StaticResource SubtitleTextBlockStyle}" />
<TextBlock Text="{x:Bind Address}"
<TextBlock Text="{x:Bind Address}"
Style="{StaticResource BodyTextBlockStyle}" />
<RatingControl MaxRating="5"
<muxc:RatingControl MaxRating="5"
Value="{x:Bind Rating}"
IsReadOnly="True"
HorizontalAlignment="Left" />
<TextBlock Text="{x:Bind Category}"
<TextBlock Text="{x:Bind Category}"
Style="{StaticResource BodyTextBlockStyle}" />
</StackPanel>
</StackPanel>
<StackPanel Grid.Column="3">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{x:Bind Distance}"
<StackPanel Grid.Column="3">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{x:Bind Distance}"
Style="{StaticResource SubtitleTextBlockStyle}"
TextWrapping="NoWrap"
Width="36" />
<TextBlock Text=" mi."
<TextBlock Text=" mi."
Style="{StaticResource SubtitleTextBlockStyle}"
TextWrapping="NoWrap"
Width="36"
Margin="6,0" />
</StackPanel>
</StackPanel>
<TextBlock Text="{x:Bind Price}"
<TextBlock Text="{x:Bind Price}"
Style="{StaticResource BodyTextBlockStyle}"
HorizontalAlignment="Right"
Margin="12,0" />
</StackPanel>
</StackPanel>
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>
<maps:MapControl x:Name="Map"
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>
</muxc:TwoPaneView.Pane1>
<muxc:TwoPaneView.Pane2>
<maps:MapControl x:Name="Map"
Grid.Column="1"
MapServiceToken="{x:Bind models:Constants.MapServiceToken}">
<maps:MapItemsControl ItemsSource="{x:Bind ViewModel.MappedLocations, Mode=OneWay}">
<maps:MapItemsControl.ItemTemplate>
<DataTemplate x:DataType="vm:MappedLocation">
<Grid Tapped="Grid_Tapped"
Tag="{x:Bind}">
<TextBlock x:Name="UserLocationIcon"
<maps:MapItemsControl ItemsSource="{x:Bind ViewModel.MappedLocations, Mode=OneWay}">
<maps:MapItemsControl.ItemTemplate>
<DataTemplate x:DataType="vm:MappedLocation">
<Grid Tapped="Grid_Tapped"
Tag="{x:Bind}">
<TextBlock x:Name="UserLocationIcon"
Visibility="{x:Bind IsCurrentLocation, Mode=OneWay}"
Text="&#xE1D2;"
FontFamily="Segoe MDL2 Assets"
@ -163,61 +154,67 @@
maps:MapControl.Location="{x:Bind Geopoint, Mode=OneWay}"
maps:MapControl.NormalizedAnchorPoint="{x:Bind vm:MainViewModel.NormalizedAnchorPoint}" />
<Grid x:Name="SelectedRestaurantIcon"
<Grid x:Name="SelectedRestaurantIcon"
Visibility="{x:Bind IsSelectedRestaurant, Mode=OneWay}"
maps:MapControl.Location="{x:Bind Geopoint, Mode=OneWay}"
maps:MapControl.NormalizedAnchorPoint="{x:Bind vm:MainViewModel.NormalizedAnchorPoint}">
<controls:DropShadowPanel Color="Black"
<ctCtrls:DropShadowPanel Color="Black"
ShadowOpacity="0.16"
OffsetX="2"
OffsetY="2"
BlurRadius="6">
<Ellipse Width="20"
<Ellipse Width="20"
Height="20"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Fill="White" />
</controls:DropShadowPanel>
<Ellipse Width="18"
Height="18"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Fill="{ThemeResource BrandPrimaryColorBrush}" />
<TextBlock Text="{x:Bind Index, Mode=OneWay}"
</ctCtrls:DropShadowPanel>
<Ellipse Width="18"
Height="18"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Fill="{ThemeResource BrandPrimaryColorBrush}" />
<TextBlock Text="{x:Bind Index, Mode=OneWay}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Padding="0,0,0,2"
Style="{StaticResource CaptionTextBlockStyle}"
Foreground="White" />
</Grid>
</Grid>
<Grid x:Name="UnselectedRestaurantIcon"
<Grid x:Name="UnselectedRestaurantIcon"
Visibility="{x:Bind IsUnselectedRestaurant, Mode=OneWay}"
maps:MapControl.Location="{x:Bind Geopoint, Mode=OneWay}"
maps:MapControl.NormalizedAnchorPoint="{x:Bind vm:MainViewModel.NormalizedAnchorPoint}">
<Ellipse Width="16"
<Ellipse Width="16"
Height="16"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Fill="White" />
<Ellipse Width="14"
<Ellipse Width="14"
Height="14"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Fill="{ThemeResource BrandPrimaryColorBrush}" />
<TextBlock Text="{x:Bind Index, Mode=OneWay}"
<TextBlock Text="{x:Bind Index, Mode=OneWay}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="Segoe UI"
FontSize="10"
Padding="0,0,0,1"
Foreground="White" />
</Grid>
</Grid>
</DataTemplate>
</maps:MapItemsControl.ItemTemplate>
</maps:MapItemsControl>
</maps:MapControl>
</Grid>
</Grid>
</DataTemplate>
</maps:MapItemsControl.ItemTemplate>
</maps:MapItemsControl>
</maps:MapControl>
</muxc:TwoPaneView.Pane2>
</muxc:TwoPaneView>
</Grid>
</Page>

Просмотреть файл

@ -30,14 +30,15 @@ and connected animations.
![LunchSchedulerBanner](Images/LunchSchedulerBanner.PNG)
This sample uses the following client libraries and services:
- [Windows UI Library (WinUI) 2.4](https://docs.microsoft.com/windows/apps/winui/winui2/)
- UWP Community Toolkit for Facebook authentication and Facebook Graph API operations
- Microsoft Graph service
- Yelp service for restaurant recommendations
- Bing maps service for rendering maps and location
> Important: This is an OSS project under the MIT license, however, the images are included for demonstration purposes only
(persons and restaurants) and cannot be distributed. They may only be used within the confines of this sample.
These images are copyrighted by Getty images, and usage is limited to the personal use and testing of this sample as outlined
> Important: This is an OSS project under the MIT license, however, the images are included for demonstration purposes only
(persons and restaurants) and cannot be distributed. They may only be used within the confines of this sample.
These images are copyrighted by Getty images, and usage is limited to the personal use and testing of this sample as outlined
in the license file.
## Prerequisites
@ -56,6 +57,8 @@ You must also install the latest [.NET Core SDK](https://www.microsoft.com/net/c
- Azure development
- .NET Core cross-platform development
> Important: This sample uses the EntityFrameworkCore 2.0 NuGet packages. The current version of the sample will break if these packages are updated.
## Running the sample
Lunch Scheduler utilizes a number of services that require registration and developer keys to function.