Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
d0b3df8
merge main -> dev (#1300)
pictos May 16, 2021
eefea7c
Merge branch 'main' into develop
jfversluis May 16, 2021
fc9e01f
Merge branch 'main' into develop
jfversluis May 17, 2021
b558d91
Merge branch 'main' into develop
jfversluis May 20, 2021
4711e71
Expander: Add touch capture view + common animation length / easing p…
AndreiMisiukevich Jun 2, 2021
867d491
Merge branch 'main' into develop
jfversluis Jun 2, 2021
e9805fd
Updated light dismiss xml docs (#1366)
SkyeHoefling Jun 5, 2021
c0dc1bb
Merge branch 'main' into develop
TheCodeTraveler Jun 7, 2021
c1e290b
Merge branch 'main' into develop
TheCodeTraveler Jun 8, 2021
70d5df5
Merge branch 'main' into develop
jfversluis Jun 14, 2021
da5d0a3
Merge branch 'main' into develop
TheCodeTraveler Jun 17, 2021
9ba26d8
Merge branch 'main' into develop
jfversluis Jun 18, 2021
6dfc3d2
[Converter] Added IsInRangeConverter (#1158)
GUOLDEV Jun 20, 2021
a762932
Drawing View (#740)
pictos Jun 20, 2021
0ab0be0
Added IsLightDismissed to PopupDismissedEvent (#1362)
SkyeHoefling Jun 20, 2021
1be322f
Merge branch 'main' into develop
TheCodeTraveler Jun 21, 2021
6e93253
Fix Android crashes if Bitmap is small, Fix iOS drawing in scrollView…
VladislavAntonyuk Jun 22, 2021
3571304
Merge branch 'main' into develop
jfversluis Jun 22, 2021
247d990
Merge branch 'main' into develop
TheCodeTraveler Jun 27, 2021
c7ef97b
Add StatusBarEffect and NavigationBarEffect classes to manage their c…
maxkoshevoi Jun 30, 2021
0822454
Merge branch 'main' into develop
TheCodeTraveler Jul 1, 2021
b08f3c4
Drawing view fixes (#1459)
VladislavAntonyuk Jul 2, 2021
50d153e
Snackbar corner radius (#1437)
VladislavAntonyuk Jul 2, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions samples/XCT.Sample.Android/MainActivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ protected override void OnCreate(Bundle savedInstanceState)
ToolbarResource = Resource.Layout.Toolbar;

base.OnCreate(savedInstanceState);

global::Xamarin.Forms.Forms.SetFlags("CollectionView_Experimental");

Essentials.Platform.Init(this, savedInstanceState);
global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
LoadApplication(new App());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<AndroidEnableSGenConcurrent>true</AndroidEnableSGenConcurrent>
<AndroidUseAapt2>true</AndroidUseAapt2>
<AndroidHttpClientHandlerType>Xamarin.Android.Net.AndroidClientHandler</AndroidHttpClientHandlerType>
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,4 @@
<None Include="app.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
</Project>
10 changes: 0 additions & 10 deletions samples/XCT.Sample.UWP/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
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;

namespace Xamarin.CommunityToolkit.Sample.UWP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,4 +164,4 @@
<VisualStudioVersion>14.0</VisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
</Project>
</Project>
108 changes: 108 additions & 0 deletions samples/XCT.Sample.WPF/DrawingViewRenderer.wpf.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
using System.Collections.Specialized;
using System.ComponentModel;
using System.Linq;
using System.Windows.Controls;
using System.Windows.Ink;
using System.Windows.Input;
using Xamarin.CommunityToolkit.Sample.WPF;
using Xamarin.CommunityToolkit.UI.Views;
using Xamarin.Forms;
using Xamarin.Forms.Platform.WPF;

[assembly: ExportRenderer(typeof(DrawingView), typeof(DrawingViewRenderer))]
namespace Xamarin.CommunityToolkit.Sample.WPF
{
public class DrawingViewRenderer : ViewRenderer<DrawingView, InkCanvas>
{
InkCanvas? canvas;

protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
{
base.OnElementPropertyChanged(sender, e);
if (e.PropertyName == DrawingView.PointsProperty.PropertyName)
{
canvas!.Strokes.StrokesChanged -= OnStrokesChanged;
canvas.Strokes.Clear();
LoadPoints();
canvas.Strokes.StrokesChanged += OnStrokesChanged;
}
}

protected override void OnElementChanged(ElementChangedEventArgs<DrawingView> e)
{
base.OnElementChanged(e);
if (Control == null && Element != null)
{
canvas = new InkCanvas
{
DefaultDrawingAttributes =
{
Color = Element.LineColor.ToMediaColor(),
Width = Element.LineWidth,
Height = Element.LineWidth
},
Background = Element.BackgroundColor.ToBrush()
};
Element.Points.CollectionChanged += OnCollectionChanged;
SetNativeControl(canvas);

canvas.Strokes.StrokesChanged += OnStrokesChanged;
Control!.PreviewMouseDown += OnPreviewMouseDown;
}

if (e.OldElement != null)
{
canvas!.Strokes.StrokesChanged -= OnStrokesChanged;
Element!.Points.CollectionChanged -= OnCollectionChanged;
if (Control != null)
Control.PreviewMouseDown -= OnPreviewMouseDown;
}
}

void OnCollectionChanged(object sender, NotifyCollectionChangedEventArgs args) => LoadPoints();

void OnPreviewMouseDown(object sender, MouseButtonEventArgs e)
{
canvas!.Strokes.Clear();
Element.Points.Clear();
}

void OnStrokesChanged(object sender, StrokeCollectionChangedEventArgs e)
{
Element.Points.CollectionChanged -= OnCollectionChanged;
if (e.Added.Count > 0)
{
var points = e.Added.First().StylusPoints.Select(point => new Point(point.X, point.Y));
Element.Points.Clear();
foreach (var point in points)
Element.Points.Add(point);

if (Element.Points.Count > 0)
{
if (Element.DrawingCompletedCommand?.CanExecute(null) ?? false)
Element.DrawingCompletedCommand.Execute(Element.Points);
}

if (Element.ClearOnFinish)
{
canvas!.Strokes.StrokesChanged -= OnStrokesChanged;
canvas.Strokes.Clear();
canvas.Strokes.StrokesChanged += OnStrokesChanged;
Element.Points.Clear();
}
}

Element.Points.CollectionChanged += OnCollectionChanged;
}

void LoadPoints()
{
var stylusPoints = Element?.Points.Select(point => new StylusPoint(point.X, point.Y)).ToList();
if (stylusPoints is { Count: > 0 })
{
var stroke = new Stroke(new StylusPointCollection(stylusPoints), canvas!.DefaultDrawingAttributes);
canvas.Strokes.Add(stroke);
}
}
}
}
17 changes: 2 additions & 15 deletions samples/XCT.Sample.WPF/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Xamarin.CommunityToolkit.UI.Views;
using Xamarin.Forms.PancakeView.Platforms.WPF;
using Xamarin.Forms.Platform.WPF;

Expand All @@ -25,7 +12,7 @@ public partial class MainWindow : FormsApplicationPage
public MainWindow()
{
InitializeComponent();
Xamarin.Forms.Forms.Init();
Forms.Forms.Init();
PancakeViewRenderer.Init();
LoadApplication(new Xamarin.CommunityToolkit.Sample.App());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="DrawingViewRenderer.wpf.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
Expand Down
5 changes: 2 additions & 3 deletions samples/XCT.Sample.iOS/AppDelegate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ namespace Xamarin.CommunityToolkit.Sample.iOS
// The UIApplicationDelegate for the application. This class is responsible for launching the
// User Interface of the application, as well as listening (and optionally responding) to
// application events from iOS.
[Register("AppDelegate")]
public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
[Register(nameof(AppDelegate))]
public class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
{
// This method is invoked when the application has loaded and is ready to run. In this
// method you should instantiate the window, load the UI into it and then make the window
Expand All @@ -16,7 +16,6 @@ public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsAppli
// You have 17 seconds to return from this method, or iOS will terminate your application.
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
global::Xamarin.Forms.Forms.SetFlags("CollectionView_Experimental");
global::Xamarin.Forms.Forms.Init();
LoadApplication(new App());

Expand Down
2 changes: 2 additions & 0 deletions samples/XCT.Sample.iOS/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,7 @@
<array>
<string>audio</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
</plist>
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,4 @@
<ItemGroup>
<BundleResource Include="Resources\triangle.png" />
</ItemGroup>
</Project>
</Project>
21 changes: 16 additions & 5 deletions samples/XCT.Sample/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:custom="clr-namespace:Xamarin.Forms.PancakeView;assembly=Xamarin.Forms.PancakeView"
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:droid="clr-namespace:Xamarin.CommunityToolkit.PlatformConfiguration.AndroidSpecific;assembly=Xamarin.CommunityToolkit"
xmlns:ios="clr-namespace:Xamarin.Forms.PlatformConfiguration.iOSSpecific;assembly=Xamarin.Forms.Core"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:xct="http://xamarin.com/schemas/2020/toolkit"
mc:Ignorable="d">
<Application.Resources>
<!-- Values -->
Expand All @@ -23,7 +25,8 @@
<Color x:Key="DarkLabelTextColor">#000000</Color>
<Color x:Key="DarkLabelPlaceholderColor">#333d47</Color>
<Color x:Key="SoftFrameBackgroundColor">#ecf0f9</Color>

<Color x:Key="StatusbarColor">#1976D2</Color>
<Color x:Key="NavBarColor">#1976D2</Color>
<!-- Fonts -->
<OnPlatform x:Key="font_bold" x:TypeArguments="x:String">
<On Platform="iOS" Value=".SFUIText-Bold" />
Expand Down Expand Up @@ -56,6 +59,10 @@
<Setter Property="BackgroundColor" Value="{StaticResource AppBackgroundColor}" />
<Setter Property="ios:Page.UseSafeArea" Value="False" />
<Setter Property="NavigationPage.BackButtonTitle" Value="" />
<Setter Property="xct:StatusBarEffect.Color" Value="{StaticResource StatusbarColor}" />
<Setter Property="xct:StatusBarEffect.Style" Value="DarkContent" />
<Setter Property="droid:NavigationBarEffect.Color" Value="{StaticResource NavBarColor}" />
<Setter Property="droid:NavigationBarEffect.Style" Value="LightContent" />
</Style>

<Style TargetType="Button">
Expand Down Expand Up @@ -96,7 +103,11 @@
<!-- Content templates -->
<ControlTemplate x:Key="GalleryPageTemplate">
<StackLayout Spacing="0">
<ListView ItemsSource="{TemplateBinding BindingContext.FilteredItems}" SelectionMode="None" HasUnevenRows="True" SeparatorVisibility="None">
<ListView
HasUnevenRows="True"
ItemsSource="{TemplateBinding BindingContext.FilteredItems}"
SelectionMode="None"
SeparatorVisibility="None">
<ListView.Header>
<ContentView Padding="20,12">
<Entry
Expand Down Expand Up @@ -127,9 +138,9 @@
</Grid.ColumnDefinitions>
<BoxView BackgroundColor="{Binding DetailColor, Source={x:RelativeSource AncestorType={x:Type ContentPage}}}" />
<StackLayout
Grid.Column="1"
Padding="0,24,24,24"
Spacing="8">
Grid.Column="1"
Padding="0,24,24,24"
Spacing="8">
<Label Style="{StaticResource label_section_header}" Text="{Binding Title}" />
<Label Text="{Binding Description}" />
</StackLayout>
Expand Down
1 change: 1 addition & 0 deletions samples/XCT.Sample/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Globalization;
using Xamarin.CommunityToolkit.Helpers;
using Xamarin.CommunityToolkit.Sample.Pages;
using Xamarin.CommunityToolkit.Sample.Pages.Views;
using Xamarin.CommunityToolkit.Sample.Resx;
using Xamarin.Forms.PlatformConfiguration;
using Xamarin.Forms.PlatformConfiguration.WindowsSpecific;
Expand Down
70 changes: 70 additions & 0 deletions samples/XCT.Sample/Pages/Converters/IsInRangeConverterPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8" ?>
<pages:BasePage
x:Class="Xamarin.CommunityToolkit.Sample.Pages.Converters.IsInRangeConverterPage"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:pages="clr-namespace:Xamarin.CommunityToolkit.Sample.Pages"
xmlns:vm="clr-namespace:Xamarin.CommunityToolkit.Sample.ViewModels.Converters"
xmlns:xct="http://xamarin.com/schemas/2020/toolkit"
x:Name="this">
<ContentPage.BindingContext>
<vm:IsInRangeConverterViewModel />
</ContentPage.BindingContext>
<ContentPage.Resources>
<ResourceDictionary>
<xct:IsInRangeConverter
x:Key="IsInRangeConverter"
MaxValue="{Binding Source={x:Reference this}, Path=BindingContext.EndDate}"
MinValue="{Binding Source={x:Reference this}, Path=BindingContext.StartDate}" />
</ResourceDictionary>
</ContentPage.Resources>
<ContentPage.Content>
<ScrollView>
<Grid
Padding="10"
ColumnDefinitions="*,*"
RowDefinitions="Auto,Auto,Auto,Auto,*">
<Label
Grid.Row="0"
Grid.Column="0"
FontAttributes="Bold"
Text="Is Date in range?" />
<Label
Grid.Row="0"
Grid.Column="1"
FontAttributes="Bold"
Text="{Binding Date, Converter={StaticResource IsInRangeConverter}}" />
<Label
Grid.Row="1"
Grid.Column="0"
Text="Date:" />
<DatePicker
Grid.Row="1"
Grid.Column="1"
Date="{Binding Date}">
<DatePicker.Format>dd/MM/yyyy</DatePicker.Format>
</DatePicker>
<Label
Grid.Row="2"
Grid.Column="0"
Text="Start Date:" />
<DatePicker
Grid.Row="2"
Grid.Column="1"
Date="{Binding StartDate}">
<DatePicker.Format>dd/MM/yyyy</DatePicker.Format>
</DatePicker>
<Label
Grid.Row="3"
Grid.Column="0"
Text="End Date:" />
<DatePicker
Grid.Row="3"
Grid.Column="1"
Date="{Binding EndDate}">
<DatePicker.Format>dd/MM/yyyy</DatePicker.Format>
</DatePicker>
</Grid>
</ScrollView>
</ContentPage.Content>
</pages:BasePage>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace Xamarin.CommunityToolkit.Sample.Pages.Converters
{
public partial class IsInRangeConverterPage
{
public IsInRangeConverterPage() => InitializeComponent();
}
}
Loading