summaryrefslogtreecommitdiff
path: root/docs/Xamarin.Forms.Core
diff options
context:
space:
mode:
authorMike Norman <mknorman@gmail.com>2017-06-14 15:54:23 (GMT)
committerGitHub <noreply@github.com>2017-06-14 15:54:23 (GMT)
commit347ec70afc9e82618dbf65612cf69fd5e6e2a960 (patch)
treefcdf49835d0d223887e88fe33599a356b28c4f36 /docs/Xamarin.Forms.Core
parent10ae30489a8b1bd096cf504c75c83c37ba9865f4 (diff)
downloadxamarin-forms-347ec70afc9e82618dbf65612cf69fd5e6e2a960.zip
xamarin-forms-347ec70afc9e82618dbf65612cf69fd5e6e2a960.tar.gz
xamarin-forms-347ec70afc9e82618dbf65612cf69fd5e6e2a960.tar.bz2
Fixed some broken links, added/updated examples in trigger-related docs (#989)
* Fixed some broken links and added/updated examples in trigger-related docs * Update docs
Diffstat (limited to 'docs/Xamarin.Forms.Core')
-rw-r--r--docs/Xamarin.Forms.Core/Xamarin.Forms/Device.xml2
-rw-r--r--docs/Xamarin.Forms.Core/Xamarin.Forms/EventTrigger.xml62
-rw-r--r--docs/Xamarin.Forms.Core/Xamarin.Forms/MasterDetailPage.xml2
-rw-r--r--docs/Xamarin.Forms.Core/Xamarin.Forms/Trigger.xml74
-rw-r--r--docs/Xamarin.Forms.Core/Xamarin.Forms/TriggerAction`1.xml41
5 files changed, 160 insertions, 21 deletions
diff --git a/docs/Xamarin.Forms.Core/Xamarin.Forms/Device.xml b/docs/Xamarin.Forms.Core/Xamarin.Forms/Device.xml
index e4704d0..43acd6e 100644
--- a/docs/Xamarin.Forms.Core/Xamarin.Forms/Device.xml
+++ b/docs/Xamarin.Forms.Core/Xamarin.Forms/Device.xml
@@ -426,7 +426,7 @@ button.HeightRequest = Device.OnPlatform (20,30,30);
</ReturnValue>
<Docs>
<summary>Gets the <see cref="T:Xamarin.Forms.TargetPlatform" /> indicating the OS Xamarin.Forms is working on.</summary>
- <value>A <see cref="Xamarin.Forms.TargetPlatform" /> that indicates the current OS.</value>
+ <value>A <see cref="T:Xamarin.Forms.TargetPlatform" /> that indicates the current OS.</value>
<remarks>
</remarks>
</Docs>
diff --git a/docs/Xamarin.Forms.Core/Xamarin.Forms/EventTrigger.xml b/docs/Xamarin.Forms.Core/Xamarin.Forms/EventTrigger.xml
index 460d81a..5220c46 100644
--- a/docs/Xamarin.Forms.Core/Xamarin.Forms/EventTrigger.xml
+++ b/docs/Xamarin.Forms.Core/Xamarin.Forms/EventTrigger.xml
@@ -21,25 +21,51 @@
<Docs>
<summary>Class that represents a triggering event and a list of <see cref="T:Xamarin.Forms.TriggerAction" /> objects that will be invoked when the event is raised.</summary>
<remarks>
- <para>XAML for Xamarin.Forms supports the following property for the <see cref="T:Xamarin.Forms.EventTrigger" /> class:</para>
- <list type="table">
- <listheader>
- <term>Property</term>
- <description>Value</description>
- </listheader>
- <item>
- <term>Event</term>
- <description>
- <para>The name of the event to which to respond.</para>
- </description>
- </item>
- <item>
- <term>Object name</term>
- <description>
- <para>The qualified name of a <see cref="T:Xamarin.Forms.TriggerAction`1" /> implementation that has been defined by the application developer. This object is instantiated and its <see cref="M:Xamarin.Forms.TriggerAction`1.Invoke" /> method is called when the triggering event is raised. Attributes on this tag set corresponding proptery values on the <see cref="T:Xamarin.Forms.TriggerAction`1" /> implementation</para> before the <see cref="M:Xamarin.Forms.TriggerAction`1.Invoke" /> method is called.</description>
- </item>
- </list>
+ <example>
+ <para>The example below shows how developers can use an event trigger to respond to events and update the value of a control property.</para>
+ <para>With the <c>ColorTriggerAction</c> class below defined in the <c>TriggerDemo</c> namespace:</para>
+ <code lang="C#"><![CDATA[public class ColorTriggerAction : TriggerAction<Entry>
+{
+ protected override void Invoke(Entry sender)
+ {
+ Color[] color ={ Color.Red,
+ Color.Orange,
+ Color.Yellow,
+ Color.Green,
+ Color.Blue,
+ Color.Indigo,
+ Color.Violet };
+ sender.TextColor = color[sender.Text.Length % color.Length];
+ }
+}]]></code>
+ <para>the developer can use the XAML below to create a page that cycles the colors of a <see cref="T:Xamarin.Forms.Entry" /> text area through the colors of the rainbow as the user enters text.</para>
+ <code lang="XAML"><![CDATA[<?xml version="1.0" encoding="utf-8"?>
+<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ xmlns:local="clr-namespace:TriggerDemo"
+ x:Class="TriggerDemo.TriggerDemoPage">
+ <StackLayout VerticalOptions="Center">
+ <Label Text="Do you see colors?"
+ VerticalOptions="Center"
+ HorizontalOptions="Center" />
+ <Entry Placeholder="Type stuff here."
+ VerticalOptions="Center"
+ HorizontalOptions="Center"
+ BackgroundColor="Black">
+ <Entry.Triggers>
+ <EventTrigger Event="TextChanged" >
+ <local:ColorTriggerAction />
+ </EventTrigger>
+ </Entry.Triggers>
+ </Entry>
+ </StackLayout>
+</ContentPage>]]></code>
+ </example>
</remarks>
+ <altmember cref="T:Xamarin.Forms.Setter" />
+ <altmember cref="T:Xamarin.Forms.PropertyCondition" />
+ <altmember cref="T:Xamarin.Forms.DataTrigger" />
+ <altmember cref="T:Xamarin.Forms.Trigger" />
</Docs>
<Members>
<Member MemberName=".ctor">
diff --git a/docs/Xamarin.Forms.Core/Xamarin.Forms/MasterDetailPage.xml b/docs/Xamarin.Forms.Core/Xamarin.Forms/MasterDetailPage.xml
index 54dafaa..d405f09 100644
--- a/docs/Xamarin.Forms.Core/Xamarin.Forms/MasterDetailPage.xml
+++ b/docs/Xamarin.Forms.Core/Xamarin.Forms/MasterDetailPage.xml
@@ -553,7 +553,7 @@ namespace FormsGallery
</ReturnValue>
<Parameters />
<Docs>
- <summary>Method that is called when the <see cref="P:Xamarin.Forms.Element.Parent" /> property of this <see cref="Xamarin.Forms.MasterDetailPage" /> is set.</summary>
+ <summary>Method that is called when the <see cref="P:Xamarin.Forms.Element.Parent" /> property of this <see cref="T:Xamarin.Forms.MasterDetailPage" /> is set.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
diff --git a/docs/Xamarin.Forms.Core/Xamarin.Forms/Trigger.xml b/docs/Xamarin.Forms.Core/Xamarin.Forms/Trigger.xml
index 3bde4c7..1be2ca3 100644
--- a/docs/Xamarin.Forms.Core/Xamarin.Forms/Trigger.xml
+++ b/docs/Xamarin.Forms.Core/Xamarin.Forms/Trigger.xml
@@ -26,7 +26,79 @@
</Attributes>
<Docs>
<summary>Class that represents a property condition and an action that is performed when the condition is met.</summary>
- <remarks>To be added.</remarks>
+ <remarks>
+ <para>The <see cref="T:Xamarin.Forms.Trigger" /> class is suitable for checking the values of any property on the control to which it has been added. That is, its default binding context is the control to which it has been added. To bind on controls other than the parent, developers should use the <see cref="T:Xamarin.Forms.DataTrigger" /> class, instead.</para>
+ <example>
+ <para>The XML example below prompts the user to type in the secret, which is, "The text color is red". When the user has typed the secret, the Entry text changes color to red. The code is turned back to the default color if the user then edits the text to differ from the secret. This example shows how to bind to the enclosing control with a trigger.</para>
+ <code lang="XML"><![CDATA[
+<?xml version="1.0" encoding="utf-8"?>
+<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ xmlns:local="clr-namespace:TriggerDemo"
+ x:Class="TriggerDemo.TriggerDemoPage">
+ <StackLayout VerticalOptions="Center">
+ <Label Text="Tell me the secret"
+ VerticalOptions="Center"
+ HorizontalOptions="Center" />
+ <Entry Placeholder="Type the secret here."
+ VerticalOptions="Center"
+ HorizontalOptions="Center">
+ <Entry.Triggers>
+ <Trigger TargetType="Entry"
+ Property="Text"
+ Value="The text color is red">
+ <Setter Property="TextColor" Value="Red" />
+ </Trigger>
+ </Entry.Triggers>
+ </Entry>
+ </StackLayout>
+</ContentPage>
+
+]]></code>
+ </example>
+ <example>
+ <para>The example below shows how developers can use a trigger to respond to events and update the value of a control property by using <see cref="T:Xamarin.Forms.TriggerAction{T}" /> classes. The example prompts the user to answer a question about the color of the text, and then calls <c>ColorTriggerAction</c> to turn the text red when the user types "The text color is red". Developers should note that, while this example does not change the text back to the default color when the user continues to edit the string, the developer could additionally implement and specify an exit action to obtain that result.</para>
+ <para>With the ColorTriggerAction class below defined in the <c>TriggerDemo</c> namespace:</para>
+ <code lang="C#"><![CDATA[public class ColorTriggerAction : TriggerAction<Entry>
+{
+ protected override void Invoke(Entry sender)
+ {
+ sender.TextColor = Color.Red;
+ }
+}]]></code>
+ <para>the developer can use the XAML below to create the page that responds to the secret string by changing the color of the <see cref="T:Xamarin.Forms.Entry" /> text area to red.</para>
+ <code lang="XAML"><![CDATA[<?xml version="1.0" encoding="utf-8"?>
+<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ xmlns:local="clr-namespace:TriggerDemo"
+ x:Class="TriggerDemo.TriggerDemoPage">
+ <StackLayout VerticalOptions="Center">
+ <Label Text="What color is &quot;The text&quot;?"
+ VerticalOptions="Center"
+ HorizontalOptions="Center" />
+ <Entry Placeholder="Type answer here."
+ VerticalOptions="Center"
+ HorizontalOptions="Center"
+ BackgroundColor="White">
+ <Entry.Triggers>
+ <Trigger TargetType="Entry"
+ Property="Text"
+ Value="The text is red" >
+ <Trigger.EnterActions>
+ <local:ColorTriggerAction />
+ </Trigger.EnterActions>
+ </Trigger>
+ </Entry.Triggers>
+ </Entry>
+ </StackLayout>
+</ContentPage>
+]]></code>
+ </example>
+ </remarks>
+ <altmember cref="T:Xamarin.Forms.Setter" />
+ <altmember cref="T:Xamarin.Forms.PropertyCondition" />
+ <altmember cref="T:Xamarin.Forms.DataTrigger" />
+ <altmember cref="T:Xamarin.Forms.TriggerAction" />
</Docs>
<Members>
<Member MemberName=".ctor">
diff --git a/docs/Xamarin.Forms.Core/Xamarin.Forms/TriggerAction`1.xml b/docs/Xamarin.Forms.Core/Xamarin.Forms/TriggerAction`1.xml
index f1748b0..611400c 100644
--- a/docs/Xamarin.Forms.Core/Xamarin.Forms/TriggerAction`1.xml
+++ b/docs/Xamarin.Forms.Core/Xamarin.Forms/TriggerAction`1.xml
@@ -24,7 +24,48 @@
<typeparam name="T">The type of which the <see cref="P:Xamarin.Forms.TriggerAction`1.AttachedObject" /> property must be an instance.</typeparam>
<summary>A generic base class for user-defined actions that are performed when a trigger condition is met.</summary>
<remarks>
+ <example>
+ <para>The example below shows how developers can use a trigger to respond to events and update the value of a control property by using <see cref="T:Xamarin.Forms.TriggerAction{T}" /> classes. The example prompts the user to answer a question about the color of the text, and then calls <c>ColorTriggerAction</c> to turn the text red when the user types "The text color is red". Developers should note that, while this example does not change the text back to the default color when the user continues to edit the string, the developer could additionally implement and specify an exit action to obtain that result.</para>
+ <para>With the ColorTriggerAction class below defined in the <c>TriggerDemo</c> namespace:</para>
+ <code lang="C#"><![CDATA[public class ColorTriggerAction : TriggerAction<Entry>
+{
+ protected override void Invoke(Entry sender)
+ {
+ sender.TextColor = Color.Red;
+ }
+}]]></code>
+ <para>the developer can use the XAML below to create the page that responds to the secret string by changing the color of the <see cref="T:Xamarin.Forms.Entry" /> text area to red.</para>
+ <code lang="XAML"><![CDATA[<?xml version="1.0" encoding="utf-8"?>
+<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ xmlns:local="clr-namespace:TriggerDemo"
+ x:Class="TriggerDemo.TriggerDemoPage">
+ <StackLayout VerticalOptions="Center">
+ <Label Text="What color is &quot;The text&quot;?"
+ VerticalOptions="Center"
+ HorizontalOptions="Center" />
+ <Entry Placeholder="Type answer here."
+ VerticalOptions="Center"
+ HorizontalOptions="Center"
+ BackgroundColor="White">
+ <Entry.Triggers>
+ <Trigger TargetType="Entry"
+ Property="Text"
+ Value="The text is red" >
+ <Trigger.EnterActions>
+ <local:ColorTriggerAction />
+ </Trigger.EnterActions>
+ </Trigger>
+ </Entry.Triggers>
+ </Entry>
+ </StackLayout>
+</ContentPage>
+]]></code>
+ </example>
</remarks>
+ <altmember cref="T:Xamarin.Forms.Setter" />
+ <altmember cref="T:Xamarin.Forms.PropertyCondition" />
+ <altmember cref="T:Xamarin.Forms.DataTrigger" />
</Docs>
<Members>
<Member MemberName=".ctor">