Added new Custom Renderer to sample
This commit is contained in:
Родитель
8709cd472b
Коммит
bb9f248fca
|
@ -0,0 +1,54 @@
|
|||
using dotnetspain2015.CustomControls;
|
||||
using System.ComponentModel;
|
||||
using Xamarin.Forms.Platform.Android;
|
||||
|
||||
namespace dotnetspain2015.Droid.Controls
|
||||
{
|
||||
public class SeparatorRenderer : ViewRenderer<SeparatorControl, SeparatorDroidView>
|
||||
{
|
||||
/// <summary>
|
||||
/// Called when [element changed].
|
||||
/// </summary>
|
||||
/// <param name="e">The e.</param>
|
||||
protected override void OnElementChanged(ElementChangedEventArgs<SeparatorControl> e)
|
||||
{
|
||||
base.OnElementChanged(e);
|
||||
|
||||
if (e.NewElement == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Control == null)
|
||||
{
|
||||
SetNativeControl(new SeparatorDroidView(Context));
|
||||
}
|
||||
|
||||
SetProperties();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the <see cref="E:ElementPropertyChanged" /> event.
|
||||
/// </summary>
|
||||
/// <param name="sender">The sender.</param>
|
||||
/// <param name="e">The <see cref="PropertyChangedEventArgs"/> instance containing the event data.</param>
|
||||
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
base.OnElementPropertyChanged(sender, e);
|
||||
SetProperties();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the properties.
|
||||
/// </summary>
|
||||
private void SetProperties()
|
||||
{
|
||||
Control.Thickness = Element.Thickness;
|
||||
Control.StrokeColor = Element.Color.ToAndroid();
|
||||
Control.StrokeType = Element.StrokeType;
|
||||
Control.Orientation = Element.Orientation;
|
||||
|
||||
Control.Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,150 @@
|
|||
using Android.App;
|
||||
using Android.Content;
|
||||
using Android.Graphics;
|
||||
using Android.Util;
|
||||
using Android.Views;
|
||||
using dotnetspain2015.CustomControls;
|
||||
|
||||
namespace dotnetspain2015.Droid.Controls
|
||||
{
|
||||
public class SeparatorDroidView : View
|
||||
{
|
||||
/// <summary>
|
||||
/// The _orientation
|
||||
/// </summary>
|
||||
private SeparatorOrientation _orientation;
|
||||
|
||||
//Density measure
|
||||
/// <summary>
|
||||
/// The dm
|
||||
/// </summary>
|
||||
private float _dm;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SeparatorDroidView" /> class.
|
||||
/// </summary>
|
||||
/// <param name="context">The context.</param>
|
||||
public SeparatorDroidView(Context context)
|
||||
: base(context)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SeparatorDroidView" /> class.
|
||||
/// </summary>
|
||||
/// <param name="context">The context.</param>
|
||||
/// <param name="attrs">The attrs.</param>
|
||||
public SeparatorDroidView(Context context, IAttributeSet attrs)
|
||||
: base(context, attrs)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SeparatorDroidView" /> class.
|
||||
/// </summary>
|
||||
/// <param name="context">The context.</param>
|
||||
/// <param name="attrs">The attrs.</param>
|
||||
/// <param name="defStyle">The definition style.</param>
|
||||
public SeparatorDroidView(Context context, IAttributeSet attrs, int defStyle)
|
||||
: base(context, attrs, defStyle)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the thickness.
|
||||
/// </summary>
|
||||
/// <value>The thickness.</value>
|
||||
public double Thickness { set; get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the color of the stroke.
|
||||
/// </summary>
|
||||
/// <value>The color of the stroke.</value>
|
||||
public Color StrokeColor { set; get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the type of the stroke.
|
||||
/// </summary>
|
||||
/// <value>The type of the stroke.</value>
|
||||
public StrokeType StrokeType { set; get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the orientation.
|
||||
/// </summary>
|
||||
/// <value>The orientation.</value>
|
||||
public SeparatorOrientation Orientation
|
||||
{
|
||||
set
|
||||
{
|
||||
_orientation = value;
|
||||
Invalidate();
|
||||
}
|
||||
get
|
||||
{
|
||||
return _orientation;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implement this to do your drawing.
|
||||
/// </summary>
|
||||
/// <param name="canvas">the canvas on which the background will be drawn</param>
|
||||
/// <since version="Added in API level 1" />
|
||||
/// <remarks>
|
||||
/// <para tool="javadoc-to-mdoc">Implement this to do your drawing.</para>
|
||||
/// <para tool="javadoc-to-mdoc">
|
||||
/// <format type="text/html">
|
||||
/// <a href="http://developer.android.com/reference/android/view/View.html#onDraw(android.graphics.Canvas)"
|
||||
/// target="_blank">
|
||||
/// [Android Documentation]
|
||||
/// </a>
|
||||
/// </format>
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
protected override void OnDraw(Canvas canvas)
|
||||
{
|
||||
base.OnDraw(canvas);
|
||||
|
||||
var r = new Rect(0, 0, canvas.Width, canvas.Height);
|
||||
var dAdjustedThicnkess = (float)Thickness * _dm;
|
||||
|
||||
var paint = new Paint { Color = StrokeColor, StrokeWidth = dAdjustedThicnkess, AntiAlias = true };
|
||||
paint.SetStyle(Paint.Style.Stroke);
|
||||
switch (StrokeType)
|
||||
{
|
||||
case StrokeType.Dashed:
|
||||
paint.SetPathEffect(new DashPathEffect(new[] { 6 * _dm, 2 * _dm }, 0));
|
||||
break;
|
||||
case StrokeType.Dotted:
|
||||
paint.SetPathEffect(new DashPathEffect(new[] { dAdjustedThicnkess, dAdjustedThicnkess }, 0));
|
||||
break;
|
||||
}
|
||||
|
||||
var thicknessOffset = (dAdjustedThicnkess) / 2.0f;
|
||||
|
||||
var p = new Path();
|
||||
if (Orientation == SeparatorOrientation.Horizontal)
|
||||
{
|
||||
p.MoveTo(0, thicknessOffset);
|
||||
p.LineTo(r.Width(), thicknessOffset);
|
||||
}
|
||||
else
|
||||
{
|
||||
p.MoveTo(thicknessOffset, 0);
|
||||
p.LineTo(thicknessOffset, r.Height());
|
||||
}
|
||||
canvas.DrawPath(p, paint);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes this instance.
|
||||
/// </summary>
|
||||
private void Initialize()
|
||||
{
|
||||
_dm = Application.Context.Resources.DisplayMetrics.Density;
|
||||
}
|
||||
}
|
||||
}
|
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичный файл не отображается.
|
@ -74,6 +74,8 @@
|
|||
<ItemGroup>
|
||||
<Compile Include="Controls\HyperLinkControlRenderer.cs" />
|
||||
<Compile Include="Controls\RoundedBoxViewRenderer.cs" />
|
||||
<Compile Include="Controls\SeparatorControlRenderer.cs" />
|
||||
<Compile Include="Controls\SeparatorDroidView.cs" />
|
||||
<Compile Include="MainActivity.cs" />
|
||||
<Compile Include="Pages\GesturedContentPageRenderer.cs" />
|
||||
<Compile Include="Resources\Resource.Designer.cs" />
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
dotnetspain2015.Droid.Controls.HyperLinkControlRenderer;dotnetspain2015.droid.controls.HyperLinkControlRenderer
|
||||
dotnetspain2015.Droid.Controls.RoundedBoxViewRenderer;dotnetspain2015.droid.controls.RoundedBoxViewRenderer
|
||||
dotnetspain2015.Droid.Controls.SeparatorRenderer;dotnetspain2015.droid.controls.SeparatorRenderer
|
||||
dotnetspain2015.Droid.Controls.SeparatorDroidView;dotnetspain2015.droid.controls.SeparatorDroidView
|
||||
dotnetspain2015.Droid.MainActivity;dotnetspain2015.droid.MainActivity
|
||||
dotnetspain2015.Droid.Pages.GesturedContentPageRenderer;dotnetspain2015.droid.pages.GesturedContentPageRenderer
|
||||
dotnetspain2015.Droid.Pages.GesturedContentPageRenderer.InternalGestureCapture;dotnetspain2015.droid.pages.GesturedContentPageRenderer_InternalGestureCapture
|
||||
|
|
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичный файл не отображается.
|
@ -0,0 +1,70 @@
|
|||
package dotnetspain2015.droid.controls;
|
||||
|
||||
|
||||
public class SeparatorDroidView
|
||||
extends android.view.View
|
||||
implements
|
||||
mono.android.IGCUserPeer
|
||||
{
|
||||
static final String __md_methods;
|
||||
static {
|
||||
__md_methods =
|
||||
"n_onDraw:(Landroid/graphics/Canvas;)V:GetOnDraw_Landroid_graphics_Canvas_Handler\n" +
|
||||
"";
|
||||
mono.android.Runtime.register ("dotnetspain2015.Droid.Controls.SeparatorDroidView, dotnetspain2015.Droid, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", SeparatorDroidView.class, __md_methods);
|
||||
}
|
||||
|
||||
|
||||
public SeparatorDroidView (android.content.Context p0) throws java.lang.Throwable
|
||||
{
|
||||
super (p0);
|
||||
if (getClass () == SeparatorDroidView.class)
|
||||
mono.android.TypeManager.Activate ("dotnetspain2015.Droid.Controls.SeparatorDroidView, dotnetspain2015.Droid, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", "Android.Content.Context, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065", this, new java.lang.Object[] { p0 });
|
||||
}
|
||||
|
||||
|
||||
public SeparatorDroidView (android.content.Context p0, android.util.AttributeSet p1) throws java.lang.Throwable
|
||||
{
|
||||
super (p0, p1);
|
||||
if (getClass () == SeparatorDroidView.class)
|
||||
mono.android.TypeManager.Activate ("dotnetspain2015.Droid.Controls.SeparatorDroidView, dotnetspain2015.Droid, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", "Android.Content.Context, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065:Android.Util.IAttributeSet, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065", this, new java.lang.Object[] { p0, p1 });
|
||||
}
|
||||
|
||||
|
||||
public SeparatorDroidView (android.content.Context p0, android.util.AttributeSet p1, int p2) throws java.lang.Throwable
|
||||
{
|
||||
super (p0, p1, p2);
|
||||
if (getClass () == SeparatorDroidView.class)
|
||||
mono.android.TypeManager.Activate ("dotnetspain2015.Droid.Controls.SeparatorDroidView, dotnetspain2015.Droid, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", "Android.Content.Context, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065:Android.Util.IAttributeSet, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065:System.Int32, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e", this, new java.lang.Object[] { p0, p1, p2 });
|
||||
}
|
||||
|
||||
|
||||
public SeparatorDroidView (android.content.Context p0, android.util.AttributeSet p1, int p2, int p3) throws java.lang.Throwable
|
||||
{
|
||||
super (p0, p1, p2, p3);
|
||||
if (getClass () == SeparatorDroidView.class)
|
||||
mono.android.TypeManager.Activate ("dotnetspain2015.Droid.Controls.SeparatorDroidView, dotnetspain2015.Droid, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", "Android.Content.Context, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065:Android.Util.IAttributeSet, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065:System.Int32, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e:System.Int32, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e", this, new java.lang.Object[] { p0, p1, p2, p3 });
|
||||
}
|
||||
|
||||
|
||||
public void onDraw (android.graphics.Canvas p0)
|
||||
{
|
||||
n_onDraw (p0);
|
||||
}
|
||||
|
||||
private native void n_onDraw (android.graphics.Canvas p0);
|
||||
|
||||
java.util.ArrayList refList;
|
||||
public void monodroidAddReference (java.lang.Object obj)
|
||||
{
|
||||
if (refList == null)
|
||||
refList = new java.util.ArrayList ();
|
||||
refList.add (obj);
|
||||
}
|
||||
|
||||
public void monodroidClearReferences ()
|
||||
{
|
||||
if (refList != null)
|
||||
refList.clear ();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
package dotnetspain2015.droid.controls;
|
||||
|
||||
|
||||
public class SeparatorRenderer
|
||||
extends xamarin.forms.platform.android.ViewRenderer_2
|
||||
implements
|
||||
mono.android.IGCUserPeer
|
||||
{
|
||||
static final String __md_methods;
|
||||
static {
|
||||
__md_methods =
|
||||
"";
|
||||
mono.android.Runtime.register ("dotnetspain2015.Droid.Controls.SeparatorRenderer, dotnetspain2015.Droid, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", SeparatorRenderer.class, __md_methods);
|
||||
}
|
||||
|
||||
|
||||
public SeparatorRenderer (android.content.Context p0) throws java.lang.Throwable
|
||||
{
|
||||
super (p0);
|
||||
if (getClass () == SeparatorRenderer.class)
|
||||
mono.android.TypeManager.Activate ("dotnetspain2015.Droid.Controls.SeparatorRenderer, dotnetspain2015.Droid, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", "Android.Content.Context, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065", this, new java.lang.Object[] { p0 });
|
||||
}
|
||||
|
||||
|
||||
public SeparatorRenderer (android.content.Context p0, android.util.AttributeSet p1) throws java.lang.Throwable
|
||||
{
|
||||
super (p0, p1);
|
||||
if (getClass () == SeparatorRenderer.class)
|
||||
mono.android.TypeManager.Activate ("dotnetspain2015.Droid.Controls.SeparatorRenderer, dotnetspain2015.Droid, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", "Android.Content.Context, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065:Android.Util.IAttributeSet, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065", this, new java.lang.Object[] { p0, p1 });
|
||||
}
|
||||
|
||||
|
||||
public SeparatorRenderer (android.content.Context p0, android.util.AttributeSet p1, int p2) throws java.lang.Throwable
|
||||
{
|
||||
super (p0, p1, p2);
|
||||
if (getClass () == SeparatorRenderer.class)
|
||||
mono.android.TypeManager.Activate ("dotnetspain2015.Droid.Controls.SeparatorRenderer, dotnetspain2015.Droid, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", "Android.Content.Context, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065:Android.Util.IAttributeSet, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065:System.Int32, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e", this, new java.lang.Object[] { p0, p1, p2 });
|
||||
}
|
||||
|
||||
java.util.ArrayList refList;
|
||||
public void monodroidAddReference (java.lang.Object obj)
|
||||
{
|
||||
if (refList == null)
|
||||
refList = new java.util.ArrayList ();
|
||||
refList.add (obj);
|
||||
}
|
||||
|
||||
public void monodroidClearReferences ()
|
||||
{
|
||||
if (refList != null)
|
||||
refList.clear ();
|
||||
}
|
||||
}
|
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичный файл не отображается.
|
@ -0,0 +1,93 @@
|
|||
using dotnetspain2015.CustomControls;
|
||||
using dotnetspain2015.WinPhone.Controls;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Platform.WinPhone;
|
||||
using System.Windows.Shapes;
|
||||
using System.Windows.Media;
|
||||
|
||||
[assembly: ExportRenderer(typeof(SeparatorControl), typeof(SeparatorControlRenderer))]
|
||||
namespace dotnetspain2015.WinPhone.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class SeparatorRenderer.
|
||||
/// </summary>
|
||||
public class SeparatorControlRenderer : ViewRenderer<SeparatorControl, Path>
|
||||
{
|
||||
/// <summary>
|
||||
/// Called when [element changed].
|
||||
/// </summary>
|
||||
/// <param name="e">The e.</param>
|
||||
protected override void OnElementChanged(ElementChangedEventArgs<SeparatorControl> e)
|
||||
{
|
||||
base.OnElementChanged(e);
|
||||
|
||||
if (e.NewElement == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Control == null)
|
||||
{
|
||||
SetNativeControl(new Path());
|
||||
}
|
||||
|
||||
SetProperties(Control);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the <see cref="E:ElementPropertyChanged" /> event.
|
||||
/// </summary>
|
||||
/// <param name="sender">The sender.</param>
|
||||
/// <param name="e">The <see cref="System.ComponentModel.PropertyChangedEventArgs"/> instance containing the event data.</param>
|
||||
protected override void OnElementPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
|
||||
{
|
||||
base.OnElementPropertyChanged(sender, e);
|
||||
SetProperties(Control);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the properties.
|
||||
/// </summary>
|
||||
/// <param name="line">The line.</param>
|
||||
private void SetProperties(Path line)
|
||||
{
|
||||
var myLineSegment = new LineSegment
|
||||
{
|
||||
Point = new System.Windows.Point(Element.Width, 0)
|
||||
};
|
||||
|
||||
var myPathSegmentCollection = new PathSegmentCollection { myLineSegment };
|
||||
|
||||
var myPathFigureCollection = new PathFigureCollection
|
||||
{
|
||||
new PathFigure
|
||||
{
|
||||
StartPoint = new System.Windows.Point(0, 0),
|
||||
Segments = myPathSegmentCollection
|
||||
}
|
||||
};
|
||||
|
||||
line.Stroke = new SolidColorBrush(
|
||||
System.Windows.Media.Color.FromArgb(
|
||||
(byte) (Element.Color.A*255),
|
||||
(byte) (Element.Color.R*255),
|
||||
(byte) (Element.Color.G*255),
|
||||
(byte) (Element.Color.B*255)));
|
||||
|
||||
line.StrokeDashArray = new DoubleCollection();
|
||||
|
||||
if (Element.StrokeType != StrokeType.Solid)
|
||||
{
|
||||
if (Element.StrokeType == StrokeType.Dashed)
|
||||
{
|
||||
line.StrokeDashArray.Add(10);
|
||||
}
|
||||
line.StrokeDashArray.Add(2);
|
||||
}
|
||||
|
||||
line.Data = new PathGeometry { Figures = myPathFigureCollection };
|
||||
|
||||
line.StrokeThickness = Element.Thickness;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -97,6 +97,7 @@
|
|||
<Compile Include="Controls\HubTileViewRenderer.cs" />
|
||||
<Compile Include="Controls\HyperLinkControlRenderer.cs" />
|
||||
<Compile Include="Controls\RoundedBoxViewRenderer.cs" />
|
||||
<Compile Include="Controls\SeparatorControlRenderer.cs" />
|
||||
<Compile Include="LocalizedStrings.cs" />
|
||||
<Compile Include="MainPage.xaml.cs">
|
||||
<DependentUpon>MainPage.xaml</DependentUpon>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<VisualStudio>
|
||||
<FlavorProperties GUID="{C089C8C0-30E0-4E22-80C0-CE093F111A43}">
|
||||
<SilverlightMobileCSProjectFlavor>
|
||||
<FullDeploy>False</FullDeploy>
|
||||
<FullDeploy>True</FullDeploy>
|
||||
<DebuggerType>Managed</DebuggerType>
|
||||
<DebuggerAgentType>Managed</DebuggerAgentType>
|
||||
<Tombstone>False</Tombstone>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<xapCache source="C:\Users\Javier\documents\visual studio 2013\Projects\dotnetspain2015\dotnetspain2015.WinPhone\Bin\Debug\PhoneApp1_Debug_AnyCPU.xap" wasSigned="False" wasTritonized="False" certificateThumbprint="" TimeStampUrl="" signKeyFile="" signKeyPassword="" lastWriteTime="22/02/2015 18:25:19">
|
||||
<file source="C:\Users\Javier\documents\visual studio 2013\Projects\dotnetspain2015\dotnetspain2015.WinPhone\obj\Debug\dotnetspain2015.WinPhone.dll" archivePath="dotnetspain2015.WinPhone.dll" lastWriteTime="22/02/2015 18:25:15" />
|
||||
<xapCache source="C:\Users\Javier\documents\visual studio 2013\Projects\dotnetspain2015\dotnetspain2015.WinPhone\Bin\Debug\PhoneApp1_Debug_AnyCPU.xap" wasSigned="False" wasTritonized="False" certificateThumbprint="" TimeStampUrl="" signKeyFile="" signKeyPassword="" lastWriteTime="22/02/2015 20:45:09">
|
||||
<file source="C:\Users\Javier\documents\visual studio 2013\Projects\dotnetspain2015\dotnetspain2015.WinPhone\obj\Debug\dotnetspain2015.WinPhone.dll" archivePath="dotnetspain2015.WinPhone.dll" lastWriteTime="22/02/2015 20:45:04" />
|
||||
<file source="C:\Users\Javier\documents\visual studio 2013\Projects\dotnetspain2015\dotnetspain2015.WinPhone\README_FIRST.txt" archivePath="README_FIRST.txt" lastWriteTime="08/02/2015 18:08:31" />
|
||||
<file source="C:\Users\Javier\documents\visual studio 2013\Projects\dotnetspain2015\dotnetspain2015.WinPhone\SplashScreenImage.jpg" archivePath="SplashScreenImage.jpg" lastWriteTime="08/02/2015 18:08:19" />
|
||||
<file source="C:\Users\Javier\documents\visual studio 2013\Projects\dotnetspain2015\dotnetspain2015.WinPhone\Assets\AlignmentGrid.png" archivePath="Assets\AlignmentGrid.png" lastWriteTime="08/02/2015 18:08:19" />
|
||||
|
@ -12,7 +12,7 @@
|
|||
<file source="C:\Users\Javier\documents\visual studio 2013\Projects\dotnetspain2015\dotnetspain2015.WinPhone\Toolkit.Content\ApplicationBar.Check.png" archivePath="Toolkit.Content\ApplicationBar.Check.png" lastWriteTime="08/02/2015 18:08:31" />
|
||||
<file source="C:\Users\Javier\documents\visual studio 2013\Projects\dotnetspain2015\dotnetspain2015.WinPhone\Toolkit.Content\ApplicationBar.Delete.png" archivePath="Toolkit.Content\ApplicationBar.Delete.png" lastWriteTime="08/02/2015 18:08:31" />
|
||||
<file source="C:\Users\Javier\documents\visual studio 2013\Projects\dotnetspain2015\dotnetspain2015.WinPhone\Toolkit.Content\ApplicationBar.Select.png" archivePath="Toolkit.Content\ApplicationBar.Select.png" lastWriteTime="08/02/2015 18:08:31" />
|
||||
<file source="C:\Users\Javier\documents\visual studio 2013\Projects\dotnetspain2015\dotnetspain2015.WinPhone\Bin\Debug\AppManifest.xaml" archivePath="AppManifest.xaml" lastWriteTime="22/02/2015 18:23:59" />
|
||||
<file source="C:\Users\Javier\documents\visual studio 2013\Projects\dotnetspain2015\dotnetspain2015.WinPhone\Bin\Debug\AppManifest.xaml" archivePath="AppManifest.xaml" lastWriteTime="22/02/2015 19:01:51" />
|
||||
<file source="C:\Users\Javier\documents\visual studio 2013\Projects\dotnetspain2015\dotnetspain2015.WinPhone\Bin\Debug\Assets\arroces.jpg" archivePath="Assets\arroces.jpg" lastWriteTime="13/02/2015 20:19:43" />
|
||||
<file source="C:\Users\Javier\documents\visual studio 2013\Projects\dotnetspain2015\dotnetspain2015.WinPhone\Bin\Debug\Assets\pastas.jpg" archivePath="Assets\pastas.jpg" lastWriteTime="13/02/2015 20:19:43" />
|
||||
<file source="C:\Users\Javier\documents\visual studio 2013\Projects\dotnetspain2015\dotnetspain2015.WinPhone\Bin\Debug\Assets\pescados.jpg" archivePath="Assets\pescados.jpg" lastWriteTime="13/02/2015 20:19:43" />
|
||||
|
@ -20,7 +20,7 @@
|
|||
<file source="C:\Users\Javier\documents\visual studio 2013\Projects\dotnetspain2015\dotnetspain2015.WinPhone\Bin\Debug\Assets\SpainDotNetConf.png" archivePath="Assets\SpainDotNetConf.png" lastWriteTime="22/02/2015 18:11:50" />
|
||||
<file source="C:\Users\Javier\documents\visual studio 2013\Projects\dotnetspain2015\dotnetspain2015.WinPhone\Bin\Debug\Assets\ApplicationIcon.png" archivePath="Assets\ApplicationIcon.png" lastWriteTime="08/02/2015 18:08:19" />
|
||||
<file source="C:\Users\Javier\documents\visual studio 2013\Projects\dotnetspain2015\dotnetspain2015.WinPhone\Bin\Debug\Assets\Tiles\FlipCycleTileMedium.png" archivePath="Assets\Tiles\FlipCycleTileMedium.png" lastWriteTime="08/02/2015 18:08:19" />
|
||||
<file source="C:\Users\Javier\documents\visual studio 2013\Projects\dotnetspain2015\dotnetspain2015\bin\Debug\dotnetspain2015.dll" archivePath="dotnetspain2015.dll" lastWriteTime="22/02/2015 18:23:18" />
|
||||
<file source="C:\Users\Javier\documents\visual studio 2013\Projects\dotnetspain2015\dotnetspain2015\bin\Debug\dotnetspain2015.dll" archivePath="dotnetspain2015.dll" lastWriteTime="22/02/2015 20:45:01" />
|
||||
<file source="C:\Users\Javier\documents\visual studio 2013\Projects\packages\WPtoolkit.4.2013.08.16\lib\wp8\Microsoft.Phone.Controls.Toolkit.dll" archivePath="Microsoft.Phone.Controls.Toolkit.dll" lastWriteTime="31/01/2015 17:32:58" />
|
||||
<file source="C:\Users\Javier\documents\visual studio 2013\Projects\packages\Xamarin.Forms.Behaviors.1.3.1\lib\Xamarin.Behaviors.dll" archivePath="Xamarin.Behaviors.dll" lastWriteTime="08/02/2015 18:51:21" />
|
||||
<file source="C:\Users\Javier\documents\visual studio 2013\Projects\packages\Xamarin.Forms.1.3.1.6296\lib\WP80\Xamarin.Forms.Core.dll" archivePath="Xamarin.Forms.Core.dll" lastWriteTime="31/01/2015 17:19:39" />
|
||||
|
@ -34,5 +34,5 @@
|
|||
<file source="C:\Users\Javier\documents\visual studio 2013\Projects\dotnetspain2015\dotnetspain2015\Assets\pescados.jpg" archivePath="dotnetspain2015\Assets\pescados.jpg" lastWriteTime="13/02/2015 20:19:43" />
|
||||
<file source="C:\Users\Javier\documents\visual studio 2013\Projects\dotnetspain2015\dotnetspain2015\Assets\rapida.jpg" archivePath="dotnetspain2015\Assets\rapida.jpg" lastWriteTime="13/02/2015 20:19:43" />
|
||||
<file source="C:\Users\Javier\documents\visual studio 2013\Projects\dotnetspain2015\dotnetspain2015\Assets\SpainDotNetConf.png" archivePath="dotnetspain2015\Assets\SpainDotNetConf.png" lastWriteTime="22/02/2015 18:11:50" />
|
||||
<file source="C:\Users\Javier\documents\visual studio 2013\Projects\dotnetspain2015\dotnetspain2015.WinPhone\Bin\Debug\Properties\WMAppManifest.xml" archivePath="WMAppManifest.xml" lastWriteTime="22/02/2015 18:23:59" />
|
||||
<file source="C:\Users\Javier\documents\visual studio 2013\Projects\dotnetspain2015\dotnetspain2015.WinPhone\Bin\Debug\Properties\WMAppManifest.xml" archivePath="WMAppManifest.xml" lastWriteTime="22/02/2015 19:01:52" />
|
||||
</xapCache>
|
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичный файл не отображается.
|
@ -0,0 +1,204 @@
|
|||
using Xamarin.Forms;
|
||||
|
||||
namespace dotnetspain2015.CustomControls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class SeparatorControl.
|
||||
/// </summary>
|
||||
public class SeparatorControl : View
|
||||
{
|
||||
/**
|
||||
* Orientation property
|
||||
*/
|
||||
/// <summary>
|
||||
/// The orientation property
|
||||
/// </summary>
|
||||
public static readonly BindableProperty OrientationProperty =
|
||||
BindableProperty.Create("Orientation", typeof(SeparatorOrientation), typeof(SeparatorControl), SeparatorOrientation.Horizontal, BindingMode.OneWay, null, null, null, null);
|
||||
|
||||
/**
|
||||
* Orientation of the separator. Only
|
||||
*/
|
||||
/// <summary>
|
||||
/// Gets the orientation.
|
||||
/// </summary>
|
||||
/// <value>The orientation.</value>
|
||||
public SeparatorOrientation Orientation
|
||||
{
|
||||
get
|
||||
{
|
||||
return (SeparatorOrientation)base.GetValue(SeparatorControl.OrientationProperty);
|
||||
}
|
||||
|
||||
private set
|
||||
{
|
||||
base.SetValue(SeparatorControl.OrientationProperty, value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Color property
|
||||
*/
|
||||
/// <summary>
|
||||
/// The color property
|
||||
/// </summary>
|
||||
public static readonly BindableProperty ColorProperty =
|
||||
BindableProperty.Create("Color", typeof(Color), typeof(SeparatorControl), Color.Default, BindingMode.OneWay, null, null, null, null);
|
||||
|
||||
/**
|
||||
* Color of the separator. Black is a default color
|
||||
*/
|
||||
/// <summary>
|
||||
/// Gets or sets the color.
|
||||
/// </summary>
|
||||
/// <value>The color.</value>
|
||||
public Color Color
|
||||
{
|
||||
get
|
||||
{
|
||||
return (Color)base.GetValue(SeparatorControl.ColorProperty);
|
||||
}
|
||||
set
|
||||
{
|
||||
base.SetValue(SeparatorControl.ColorProperty, value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Thickness property
|
||||
*/
|
||||
/// <summary>
|
||||
/// The thickness property
|
||||
/// </summary>
|
||||
public static readonly BindableProperty ThicknessProperty =
|
||||
BindableProperty.Create("Thickness", typeof(double), typeof(SeparatorControl), (double)1, BindingMode.OneWay, null, null, null, null);
|
||||
|
||||
|
||||
/**
|
||||
* How thick should the separator be. Default is 1
|
||||
*/
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the thickness.
|
||||
/// </summary>
|
||||
/// <value>The thickness.</value>
|
||||
public double Thickness
|
||||
{
|
||||
get
|
||||
{
|
||||
return (double)base.GetValue(SeparatorControl.ThicknessProperty);
|
||||
}
|
||||
set
|
||||
{
|
||||
base.SetValue(SeparatorControl.ThicknessProperty, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Stroke type property
|
||||
*/
|
||||
/// <summary>
|
||||
/// The stroke type property
|
||||
/// </summary>
|
||||
public static readonly BindableProperty StrokeTypeProperty =
|
||||
BindableProperty.Create("StrokeType", typeof(StrokeType), typeof(SeparatorControl), StrokeType.Solid, BindingMode.OneWay, null, null, null, null);
|
||||
|
||||
/**
|
||||
* Stroke style of the separator. Default is Solid.
|
||||
*/
|
||||
/// <summary>
|
||||
/// Gets or sets the type of the stroke.
|
||||
/// </summary>
|
||||
/// <value>The type of the stroke.</value>
|
||||
public StrokeType StrokeType
|
||||
{
|
||||
get
|
||||
{
|
||||
return (StrokeType)base.GetValue(SeparatorControl.StrokeTypeProperty);
|
||||
}
|
||||
set
|
||||
{
|
||||
base.SetValue(SeparatorControl.StrokeTypeProperty, value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SeparatorControl"/> class.
|
||||
/// </summary>
|
||||
public SeparatorControl()
|
||||
{
|
||||
UpdateRequestedSize();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Call this method from a child class to notify that a change happened on a property.
|
||||
/// </summary>
|
||||
/// <param name="propertyName">The name of the property that changed.</param>
|
||||
/// <remarks>A <see cref="T:Xamarin.Forms.BindableProperty" /> triggers this by itself. An inheritor only needs to call this for properties without <see cref="T:Xamarin.Forms.BindableProperty" /> as the backend store.</remarks>
|
||||
protected override void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
base.OnPropertyChanged(propertyName);
|
||||
if (propertyName == ThicknessProperty.PropertyName ||
|
||||
propertyName == ColorProperty.PropertyName ||
|
||||
propertyName == StrokeTypeProperty.PropertyName ||
|
||||
propertyName == OrientationProperty.PropertyName)
|
||||
{
|
||||
UpdateRequestedSize();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Updates the size of the requested.
|
||||
/// </summary>
|
||||
private void UpdateRequestedSize()
|
||||
{
|
||||
var minSize = Thickness;
|
||||
var optimalSize = Thickness;
|
||||
if (Orientation == SeparatorOrientation.Horizontal)
|
||||
{
|
||||
MinimumHeightRequest = minSize;
|
||||
HeightRequest = optimalSize;
|
||||
HorizontalOptions = LayoutOptions.FillAndExpand;
|
||||
}
|
||||
else
|
||||
{
|
||||
MinimumWidthRequest = minSize;
|
||||
WidthRequest = optimalSize;
|
||||
VerticalOptions = LayoutOptions.FillAndExpand;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enum StrokeType
|
||||
/// </summary>
|
||||
public enum StrokeType{
|
||||
/// <summary>
|
||||
/// The solid
|
||||
/// </summary>
|
||||
Solid,
|
||||
/// <summary>
|
||||
/// The dotted
|
||||
/// </summary>
|
||||
Dotted,
|
||||
/// <summary>
|
||||
/// The dashed
|
||||
/// </summary>
|
||||
Dashed
|
||||
}
|
||||
/// <summary>
|
||||
/// Enum SeparatorOrientation
|
||||
/// </summary>
|
||||
public enum SeparatorOrientation{
|
||||
/// <summary>
|
||||
/// The vertical
|
||||
/// </summary>
|
||||
Vertical,
|
||||
/// <summary>
|
||||
/// The horizontal
|
||||
/// </summary>
|
||||
Horizontal
|
||||
}
|
||||
}
|
|
@ -7,6 +7,8 @@
|
|||
<custom:RoundedBoxView x:Name="rbv" WidthRequest="200" HeightRequest="200"
|
||||
Stroke="Yellow" StrokeThickness="2" CornerRadius="20"
|
||||
Color="Red" />
|
||||
<custom:SeparatorControl Color="Red"
|
||||
StrokeType="Dashed"/>
|
||||
<Label Text="Corner Radius" />
|
||||
<Slider x:Name="theSlider" Minimum="0" Maximum="75"
|
||||
BindingContext="{x:Reference rbv}"
|
||||
|
|
|
@ -11,4 +11,4 @@
|
|||
<custom:HyperLinkControl Text="Url"
|
||||
NavigateUri="http://www.desarrollaconmicrosoft.com/dotnetspain2015" />
|
||||
</StackLayout>
|
||||
</ContentPage>
|
||||
</ContentPage>
|
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичный файл не отображается.
|
@ -38,6 +38,7 @@
|
|||
<Compile Include="CustomControls\HubTileView.cs" />
|
||||
<Compile Include="CustomControls\HyperLinkControl.cs" />
|
||||
<Compile Include="CustomControls\RoundedBoxView.cs" />
|
||||
<Compile Include="CustomControls\SeparatorControl.cs" />
|
||||
<Compile Include="CustomPages\GesturedContentPage.cs" />
|
||||
<Compile Include="MarkupExtensions\DateDisplayExtension.cs" />
|
||||
<Compile Include="MarkupExtensions\TranslateExtension.cs" />
|
||||
|
|
|
@ -24,3 +24,4 @@ C:\Users\Javier\documents\visual studio 2013\Projects\dotnetspain2015\dotnetspai
|
|||
C:\Users\Javier\documents\visual studio 2013\Projects\dotnetspain2015\dotnetspain2015\obj\Debug\ExtendControlView.xaml.g.cs
|
||||
C:\Users\Javier\documents\visual studio 2013\Projects\dotnetspain2015\dotnetspain2015\obj\Debug\LoadingView.xaml.g.cs
|
||||
C:\Users\Javier\documents\visual studio 2013\Projects\dotnetspain2015\dotnetspain2015\bin\Debug\Assets\SpainDotNetConf.png
|
||||
C:\Users\Javier\documents\visual studio 2013\Projects\dotnetspain2015\dotnetspain2015\obj\Debug\dotnetspain2015.csprojResolveAssemblyReference.cache
|
||||
|
|
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичный файл не отображается.
Загрузка…
Ссылка в новой задаче