feat(CalendarView): Add CalendarView/CalendarDatePicker samples

This commit is contained in:
Steve Bilogan 2021-06-07 14:24:26 -04:00
Родитель bc54ce480a
Коммит 3ba4b1657a
12 изменённых файлов: 338 добавлений и 29 удалений

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

@ -108,10 +108,10 @@
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Uno.Cupertino">
<Version>1.0.0-dev.772</Version>
<Version>1.0.0-dev.774</Version>
</PackageReference>
<PackageReference Include="Uno.Material">
<Version>1.0.0-dev.772</Version>
<Version>1.0.0-dev.774</Version>
</PackageReference>
<PackageReference Include="Uno.ShowMeTheXAML">
<Version>1.0.59</Version>
@ -120,12 +120,12 @@
<Version>1.0.59</Version>
</PackageReference>
<PackageReference Include="Uno.UI">
<Version>3.8.0-dev.302</Version>
<Version>3.8.0-dev.439</Version>
</PackageReference>
<PackageReference Include="Uno.UI.Lottie">
<Version>3.8.0-dev.302</Version>
<Version>3.8.0-dev.439</Version>
</PackageReference>
<PackageReference Include="Uno.UI.RemoteControl" Version="3.8.0-dev.302" Condition="'$(Configuration)'=='Debug'" />
<PackageReference Include="Uno.UI.RemoteControl" Version="3.8.0-dev.439" Condition="'$(Configuration)'=='Debug'" />
<PackageReference Include="Uno.UniversalImageLoader" Version="1.9.33" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Filter" Version="1.1.1" />

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

@ -27,8 +27,8 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Uno.Cupertino" Version="1.0.0-dev.772" />
<PackageReference Include="Uno.Material" Version="1.0.0-dev.772" />
<PackageReference Include="Uno.Cupertino" Version="1.0.0-dev.774" />
<PackageReference Include="Uno.Material" Version="1.0.0-dev.774" />
<!-- Note that for WebAssembly version 1.1.1 of the console logger required -->
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Filter" Version="1.1.1" />
@ -46,9 +46,9 @@
</PackageReference>
<PackageReference Include="Uno.ShowMeTheXAML" Version="1.0.59" />
<PackageReference Include="Uno.ShowMeTheXAML.MSBuild" Version="1.0.59" />
<PackageReference Include="Uno.UI.Lottie" Version="3.8.0-dev.302" />
<PackageReference Include="Uno.UI.Skia.Gtk" Version="3.8.0-dev.302" />
<PackageReference Include="Uno.UI.RemoteControl" Version="3.8.0-dev.302" Condition="'$(Configuration)'=='Debug'" />
<PackageReference Include="Uno.UI.Lottie" Version="3.8.0-dev.439" />
<PackageReference Include="Uno.UI.Skia.Gtk" Version="3.8.0-dev.439" />
<PackageReference Include="Uno.UI.RemoteControl" Version="3.8.0-dev.439" Condition="'$(Configuration)'=='Debug'" />
</ItemGroup>
<Import Project="..\Uno.Gallery.Shared\Uno.Gallery.Shared.projitems" Label="Shared" />

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

@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
using Uno.UITest.Helpers;
using Uno.UITest.Helpers.Queries;
using Uno.UITests.Helpers;
namespace Uno.Gallery.UITests
{
public class Given_CalendarView : TestBase
{
[Test]
public void When_CalendarViewMaterial()
{
NavigateToSample("CalendarView");
ShowMaterialTheme();
TakeScreenshot("Material CalendarView");
App.WaitForElement(q => q.All().Marked("Material_CalendarView"));
}
[Test]
public void When_CalendarViewCupertino()
{
NavigateToSample("CalendarView");
ShowCupertinoTheme();
TakeScreenshot("Cupertino CalendarView");
App.WaitForElement(q => q.All().Marked("Cupertino_CalendarView"));
}
[Test]
public void When_CalendarViewFluent()
{
NavigateToSample("CalendarView");
ShowFluentTheme();
TakeScreenshot("Fluent CalendarView");
App.WaitForElement(q => q.All().Marked("Fluent_CalendarView"));
}
}
}

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

@ -13,8 +13,9 @@
<ResourceDictionary Source="Views/Converters.xaml" />
<ResourceDictionary Source="Views/Fonts.xaml" />
<ResourceDictionary Source="Views/Styles/Banner.xaml" />
<ResourceDictionary Source="Views/Styles/Button.xaml" />
<ResourceDictionary Source="Views/Styles/ColorPaletteView.xaml" />
<ResourceDictionary Source="Views/Styles/ContentPageLayout.xaml" />
<ResourceDictionary Source="Views/Styles/FluentPaletteView.xaml" />

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

@ -40,10 +40,10 @@
</PackageReference>
<PackageReference Include="Uno.Core" Version="2.3.0" />
<PackageReference Include="Uno.Cupertino">
<Version>1.0.0-dev.772</Version>
<Version>1.0.0-dev.774</Version>
</PackageReference>
<PackageReference Include="Uno.Material">
<Version>1.0.0-dev.772</Version>
<Version>1.0.0-dev.774</Version>
</PackageReference>
<PackageReference Include="Uno.ShowMeTheXAML">
<Version>1.0.59</Version>
@ -52,7 +52,7 @@
<Version>1.0.59</Version>
</PackageReference>
<PackageReference Include="Uno.UI">
<Version>3.8.0-dev.302</Version>
<Version>3.8.0-dev.439</Version>
</PackageReference>
</ItemGroup>
<PropertyGroup>
@ -209,6 +209,9 @@
<Compile Include="Views\SamplePages\BottomNavigationBarSamplePage.xaml.cs">
<DependentUpon>BottomNavigationBarSamplePage.xaml</DependentUpon>
</Compile>
<Compile Include="Views\SamplePages\CalendarViewSamplePage.xaml.cs">
<DependentUpon>CalendarViewSamplePage.xaml</DependentUpon>
</Compile>
<Compile Include="Views\SamplePages\CardSamplePage.xaml.cs">
<DependentUpon>CardSamplePage.xaml</DependentUpon>
</Compile>
@ -436,6 +439,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\SamplePages\CalendarViewSamplePage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\SamplePages\CardSamplePage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@ -608,6 +615,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\Styles\Button.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\Styles\TextBlock.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>

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

@ -0,0 +1,114 @@
<Page x:Class="Uno.Gallery.Views.SamplePages.CalendarViewSamplePage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Uno.Gallery"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:smtx="using:ShowMeTheXAML"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<local:SamplePageLayout>
<local:SamplePageLayout.MaterialTemplate>
<DataTemplate>
<StackPanel Spacing="20">
<smtx:XamlDisplay UniqueKey="CalendarViewSamplePage_Material_CalendarView"
smtx:XamlDisplayExtensions.Header="CalendarView"
Style="{StaticResource XamlDisplayBelowStyle}">
<StackPanel Spacing="20">
<TextBlock Text="Selection Mode:"
Style="{StaticResource MaterialBody1}" />
<ComboBox Style="{StaticResource MaterialComboBoxStyle}"
SelectedIndex="0"
x:Name="Material_SelectionMode">
<ComboBox.Items>
<x:String>Single</x:String>
<x:String>Multiple</x:String>
</ComboBox.Items>
</ComboBox>
<CalendarView SelectionMode="{Binding SelectedItem, ElementName=Material_SelectionMode}"
x:Name="Material_CalendarView"
AutomationProperties.AutomationId="Material_CalendarView"
Style="{StaticResource MaterialCalendarViewStyle}" />
</StackPanel>
</smtx:XamlDisplay>
<smtx:XamlDisplay UniqueKey="CalendarViewSamplePage_Material_CalendarDatePicker"
smtx:XamlDisplayExtensions.Header="CalendarDatePicker">
<CalendarDatePicker Header="Date"
x:Name="Material_CalendarDatePicker"
AutomationProperties.AutomationId="Material_CalendarDatePicker"
Style="{StaticResource MaterialCalendarDatePickerStyle}" />
</smtx:XamlDisplay>
</StackPanel>
</DataTemplate>
</local:SamplePageLayout.MaterialTemplate>
<local:SamplePageLayout.CupertinoTemplate>
<DataTemplate>
<StackPanel Spacing="20">
<smtx:XamlDisplay UniqueKey="CalendarViewSamplePage_Cupertino_CalendarView"
smtx:XamlDisplayExtensions.Header="CalendarView"
Style="{StaticResource XamlDisplayBelowStyle}">
<StackPanel Spacing="20">
<TextBlock Text="Selection Mode:"
Style="{StaticResource CupertinoBody}" />
<ComboBox Style="{StaticResource CupertinoComboBoxStyle}"
SelectedIndex="0"
x:Name="Cupertino_SelectionMode">
<ComboBox.Items>
<x:String>Single</x:String>
<x:String>Multiple</x:String>
</ComboBox.Items>
</ComboBox>
<CalendarView SelectionMode="{Binding SelectedItem, ElementName=Cupertino_SelectionMode}"
x:Name="Cupertino_CalendarView"
AutomationProperties.AutomationId="Cupertino_CalendarView"
Style="{StaticResource CupertinoCalendarViewStyle}" />
</StackPanel>
</smtx:XamlDisplay>
<smtx:XamlDisplay UniqueKey="CalendarViewSamplePage_Cupertino_CalendarDatePicker"
smtx:XamlDisplayExtensions.Header="CalendarDatePicker">
<CalendarDatePicker Header="Date"
x:Name="Cupertino_CalendarDatePicker"
AutomationProperties.AutomationId="Cupertino_CalendarDatePicker"
Style="{StaticResource CupertinoCalendarDatePickerStyle}" />
</smtx:XamlDisplay>
</StackPanel>
</DataTemplate>
</local:SamplePageLayout.CupertinoTemplate>
<local:SamplePageLayout.FluentTemplate>
<DataTemplate>
<StackPanel Spacing="20">
<smtx:XamlDisplay UniqueKey="CalendarViewSamplePage_Fluent_CalendarView"
smtx:XamlDisplayExtensions.Header="CalendarView"
Style="{StaticResource XamlDisplayBelowStyle}">
<StackPanel Spacing="20">
<TextBlock Text="Selection Mode:"
Style="{StaticResource BodyTextBlockStyle}" />
<ComboBox SelectedIndex="0"
x:Name="Fluent_SelectionMode">
<ComboBox.Items>
<x:String>Single</x:String>
<x:String>Multiple</x:String>
</ComboBox.Items>
</ComboBox>
<CalendarView SelectionMode="{Binding SelectedItem, ElementName=Fluent_SelectionMode}"
x:Name="Fluent_CalendarView"
AutomationProperties.AutomationId="Fluent_CalendarView" />
</StackPanel>
</smtx:XamlDisplay>
<smtx:XamlDisplay UniqueKey="CalendarViewSamplePage_Fluent_CalendarDatePicker"
smtx:XamlDisplayExtensions.Header="CalendarDatePicker">
<CalendarDatePicker Header="Date"
x:Name="Fluent_CalendarDatePicker"
AutomationProperties.AutomationId="Fluent_CalendarDatePicker" />
</smtx:XamlDisplay>
</StackPanel>
</DataTemplate>
</local:SamplePageLayout.FluentTemplate>
</local:SamplePageLayout>
</Grid>
</Page>

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

@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
namespace Uno.Gallery.Views.SamplePages
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
[SamplePage(SampleCategory.Components, "CalendarView", Description = "Represents a control that enables a user to select a date by using a visual calendar display.", DocumentationLink = "https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.calendarview")]
public sealed partial class CalendarViewSamplePage : Page
{
public CalendarViewSamplePage()
{
this.InitializeComponent();
}
}
}

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

@ -0,0 +1,68 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:win="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:not_win="http://uno.ui/not_win"
mc:Ignorable="not_win">
<Style x:Key="SeeSourceFlyoutButtonStyle"
TargetType="Button">
<Setter Property="Tag"
Value="See Source" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid x:Name="Root">
<Button Content="{TemplateBinding Tag}"
FontSize="10"
Style="{StaticResource MaterialTextButtonStyle}">
<Button.Flyout>
<Flyout Placement="LeftEdgeAlignedBottom">
<Flyout.FlyoutPresenterStyle>
<Style TargetType="FlyoutPresenter">
<Setter Property="ScrollViewer.HorizontalScrollMode"
Value="Disabled" />
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility"
Value="Disabled" />
<Setter Property="ScrollViewer.VerticalScrollMode"
Value="Disabled" />
<Setter Property="ScrollViewer.VerticalScrollBarVisibility"
Value="Disabled" />
<Setter Property="MinHeight"
Value="0" />
<Setter Property="MinWidth"
Value="0" />
<Setter Property="Padding"
Value="0,0,0,2" />
<Setter Property="Margin"
not_win:Value="40,100,40,40"
win:Value="40,0,40,0" />
</Style>
</Flyout.FlyoutPresenterStyle>
<ScrollViewer HorizontalScrollMode="Enabled"
HorizontalScrollBarVisibility="Visible"
VerticalScrollMode="Enabled"
VerticalScrollBarVisibility="Visible">
<TextBlock Text="{TemplateBinding Content}"
FontFamily="{StaticResource RobotoFontFamily}"
IsTextSelectionEnabled="True"
Margin="16" />
</ScrollViewer>
</Flyout>
</Button.Flyout>
</Button>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="SeeXamlFlyoutButtonStyle"
BasedOn="{StaticResource SeeSourceFlyoutButtonStyle}"
TargetType="Button">
<Setter Property="Tag"
Value="See Xaml" />
</Style>
</ResourceDictionary>

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

@ -237,6 +237,41 @@
</Setter>
</Style>
<Style x:Key="BaseXamlDisplayStyle"
TargetType="smtx:XamlDisplay">
<Setter Property="Margin" Value="0,10,0,0" />
<Setter Property="Formatter" Value="{StaticResource NiceFormatter}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="smtx:XamlDisplay">
<StackPanel Orientation="Horizontal">
<ContentPresenter Content="{TemplateBinding Content}" />
<Button Content="{TemplateBinding Xaml}"
Style="{StaticResource SeeXamlFlyoutButtonStyle}" />
</StackPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="XamlDisplayBelowStyle"
BasedOn="{StaticResource BaseXamlDisplayStyle}"
TargetType="smtx:XamlDisplay">
<Setter Property="Padding" Value="0,5,0,0" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="smtx:XamlDisplay">
<StackPanel Orientation="Vertical">
<ContentPresenter Content="{TemplateBinding Content}" />
<Button Content="{TemplateBinding Xaml}"
Margin="{TemplateBinding Padding}"
Style="{StaticResource SeeXamlFlyoutButtonStyle}" />
</StackPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="smtx:XamlDisplay"
BasedOn="{StaticResource ExpanderXamlDisplayStyle}" />

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

@ -105,14 +105,14 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Windows.Compatibility" Version="5.0.1" />
<PackageReference Include="Uno.Cupertino" Version="1.0.0-dev.772" />
<PackageReference Include="Uno.Cupertino" Version="1.0.0-dev.774" />
<PackageReference Include="Uno.Diagnostics.Eventing" Version="1.0.5-dev.13" />
<PackageReference Include="Uno.Material" Version="1.0.0-dev.772" />
<PackageReference Include="Uno.Material" Version="1.0.0-dev.774" />
<PackageReference Include="Uno.ShowMeTheXAML" Version="1.0.59" />
<PackageReference Include="Uno.ShowMeTheXAML.MSBuild" Version="1.0.59" />
<PackageReference Include="Uno.UI.Lottie" Version="3.8.0-dev.302" />
<PackageReference Include="Uno.UI.WebAssembly" Version="3.8.0-dev.302" />
<PackageReference Include="Uno.UI.RemoteControl" Version="3.8.0-dev.302" Condition="'$(Configuration)'=='Debug'" />
<PackageReference Include="Uno.UI.Lottie" Version="3.8.0-dev.439" />
<PackageReference Include="Uno.UI.WebAssembly" Version="3.8.0-dev.439" />
<PackageReference Include="Uno.UI.RemoteControl" Version="3.8.0-dev.439" Condition="'$(Configuration)'=='Debug'" />
<PackageReference Include="Uno.Wasm.Bootstrap" Version="2.1.0-dev.45" />
<PackageReference Include="Uno.Wasm.Bootstrap.DevServer" Version="2.1.0-dev.45" />
<PackageReference Include="Microsoft.TypeScript.Compiler" Version="3.1.5">

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

@ -212,10 +212,10 @@
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Uno.Cupertino">
<Version>1.0.0-dev.772</Version>
<Version>1.0.0-dev.774</Version>
</PackageReference>
<PackageReference Include="Uno.Material">
<Version>1.0.0-dev.772</Version>
<Version>1.0.0-dev.774</Version>
</PackageReference>
<PackageReference Include="Uno.ShowMeTheXAML">
<Version>1.0.59</Version>
@ -224,12 +224,12 @@
<Version>1.0.59</Version>
</PackageReference>
<PackageReference Include="Uno.UI">
<Version>3.8.0-dev.302</Version>
<Version>3.8.0-dev.439</Version>
</PackageReference>
<PackageReference Include="Uno.UI.Lottie">
<Version>3.8.0-dev.302</Version>
<Version>3.8.0-dev.439</Version>
</PackageReference>
<PackageReference Include="Uno.UI.RemoteControl" Version="3.8.0-dev.302" Condition="'$(Configuration)'=='Debug'" />
<PackageReference Include="Uno.UI.RemoteControl" Version="3.8.0-dev.439" Condition="'$(Configuration)'=='Debug'" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Filter" Version="1.1.1" />
<PackageReference Include="Xamarin.Essentials">

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

@ -103,10 +103,10 @@
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Uno.Cupertino">
<Version>1.0.0-dev.772</Version>
<Version>1.0.0-dev.774</Version>
</PackageReference>
<PackageReference Include="Uno.Material">
<Version>1.0.0-dev.772</Version>
<Version>1.0.0-dev.774</Version>
</PackageReference>
<PackageReference Include="Uno.ShowMeTheXAML">
<Version>1.0.59</Version>
@ -115,12 +115,12 @@
<Version>1.0.59</Version>
</PackageReference>
<PackageReference Include="Uno.UI">
<Version>3.8.0-dev.302</Version>
<Version>3.8.0-dev.439</Version>
</PackageReference>
<PackageReference Include="Uno.UI.Lottie">
<Version>3.8.0-dev.302</Version>
<Version>3.8.0-dev.439</Version>
</PackageReference>
<PackageReference Include="Uno.UI.RemoteControl" Version="3.8.0-dev.302" Condition="'$(Configuration)'=='Debug'" />
<PackageReference Include="Uno.UI.RemoteControl" Version="3.8.0-dev.439" Condition="'$(Configuration)'=='Debug'" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Filter" Version="1.1.1" />
</ItemGroup>