Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replaced container frame with transparent StackLayout #11

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
20 changes: 11 additions & 9 deletions SwipeCards.Controls/Arguments/DraggingEventArgs.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
using System;

namespace SwipeCards.Controls.Arguments
namespace SwipeCards
{
public class DraggingEventArgs : EventArgs
{
public readonly object Item;
public class DraggingEventArgs : EventArgs
{
public object Item { get; private set; }
public double Distance { get; private set; }

public DraggingEventArgs(object item)
{
this.Item = item;
}
}
public DraggingEventArgs(object item, double distance)
{
Item = item;
Distance = distance;
}
}
}
31 changes: 16 additions & 15 deletions SwipeCards.Controls/Arguments/SwipedEventArgs.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
using System;

namespace SwipeCards.Controls.Arguments
namespace SwipeCards
{
public class SwipedEventArgs : EventArgs
{
public readonly object Item;
public readonly SwipeDirection Direction;
public class SwipedEventArgs : EventArgs
{
public object Item { get; private set; }
public SwipeDirection Direction { get; private set; }

public SwipedEventArgs(object item, SwipeDirection direction)
{
this.Item = item;
this.Direction = direction;
}
}
public SwipedEventArgs(object item, SwipeDirection direction)
{
Item = item;
Direction = direction;
}
}

public enum SwipeDirection
{
Left, Right
}
public enum SwipeDirection
{
Left,
Right
}
}
8 changes: 6 additions & 2 deletions SwipeCards.Controls/SwipeCards.Controls.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<Title>SwipeCards for Xamarin.Forms</Title>
<PackOnBuild>true</PackOnBuild>
<PackageReleaseNotes>Add methods for programmatic swiping.</PackageReleaseNotes>
<TargetFramework>netstandard1.6</TargetFramework>
</PropertyGroup>
<!-- any extra properties for the .NET Standard build -->
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard1.0'">
Expand All @@ -32,10 +33,13 @@
<TargetPlatformVersion>10.0.16299.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.10240.0</TargetPlatformMinVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType></DebugType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NuGet.Build.Packaging" Version="0.2.2" />
<PackageReference Include="MSBuild.Sdk.Extras" Version="1.2.1" />
<PackageReference Include="Xamarin.Forms" Version="2.5.0.280555" />
<PackageReference Include="MSBuild.Sdk.Extras" Version="1.5.4" />
<PackageReference Include="Xamarin.Forms" Version="3.0.0.482510" />
</ItemGroup>
<Import Project="$(MSBuildSDKExtrasTargets)" Condition="Exists('$(MSBuildSDKExtrasTargets)')" />
</Project>
19 changes: 2 additions & 17 deletions SwipeCards.Controls/Views/CardStackView.xaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>
<ContentView
x:Class="SwipeCards.Controls.CardStackView"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
Padding="20">
<ContentView x:Class="SwipeCards.CardStackView" xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">

<Grid>
<RelativeLayout x:Name="CardStack" />

<!--
HACK: The TouchObserber is a terrible hack, so let me explain the problem
On Android, Child elements obserb touch events and don't pass them to the sender.
So when attaching the PanGestureRecognizer to the parent view, it won't fire, when dragging the child.
To fix this temporary, I added this transparent view on top of all others and attach the PanGestureRecognizer to it.
A custom view renderer with an "IgnoreTouch" property might be a smarter solution...
-->
<BoxView x:Name="TouchObserber" BackgroundColor="Transparent" />
</Grid>
<RelativeLayout x:Name="CardStack" />

</ContentView>
Loading