summaryrefslogtreecommitdiff
path: root/docs/Xamarin.Forms.Core/Xamarin.Forms/BindableObjectExtensions.xml
blob: a99bf66f9c7474fadd7bce96d4c1b1fd9bf95b95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<Type Name="BindableObjectExtensions" FullName="Xamarin.Forms.BindableObjectExtensions">
  <TypeSignature Language="C#" Value="public static class BindableObjectExtensions" />
  <TypeSignature Language="ILAsm" Value=".class public auto ansi abstract sealed beforefieldinit BindableObjectExtensions extends System.Object" />
  <AssemblyInfo>
    <AssemblyName>Xamarin.Forms.Core</AssemblyName>
    <AssemblyVersion>1.0.0.0</AssemblyVersion>
    <AssemblyVersion>1.1.0.0</AssemblyVersion>
    <AssemblyVersion>1.2.0.0</AssemblyVersion>
    <AssemblyVersion>1.3.0.0</AssemblyVersion>
    <AssemblyVersion>1.4.0.0</AssemblyVersion>
    <AssemblyVersion>1.5.0.0</AssemblyVersion>
    <AssemblyVersion>2.0.0.0</AssemblyVersion>
  </AssemblyInfo>
  <Base>
    <BaseTypeName>System.Object</BaseTypeName>
  </Base>
  <Interfaces />
  <Docs>
    <summary>Contains convenience extension methods for <see cref="T:Xamarin.Forms.BindableObject" />.</summary>
    <remarks>
    </remarks>
  </Docs>
  <Members>
    <Member MemberName="SetBinding">
      <MemberSignature Language="C#" Value="public static void SetBinding (this Xamarin.Forms.BindableObject self, Xamarin.Forms.BindableProperty targetProperty, string path);" />
      <MemberSignature Language="ILAsm" Value=".method public static hidebysig void SetBinding(class Xamarin.Forms.BindableObject self, class Xamarin.Forms.BindableProperty targetProperty, string path) cil managed" />
      <MemberType>Method</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>1.0.0.0</AssemblyVersion>
        <AssemblyVersion>1.1.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>System.Void</ReturnType>
      </ReturnValue>
      <Parameters>
        <Parameter Name="self" Type="Xamarin.Forms.BindableObject" RefType="this" />
        <Parameter Name="targetProperty" Type="Xamarin.Forms.BindableProperty" />
        <Parameter Name="path" Type="System.String" />
      </Parameters>
      <Docs>
        <param name="self">The <see cref="T:Xamarin.Forms.BindableObject" />.</param>
        <param name="targetProperty">The BindableProperty on which to set a binding.</param>
        <param name="path">A <see cref="T:System.String" /> indicating the property path to bind to.</param>
        <summary>Creates and applies a binding to a property.</summary>
        <remarks>
          <para>The following example shows how to use the extension method to set a binding.</para>
          <example>
            <code lang="C#"><![CDATA[
var label = new Label ();
label.SetBinding (Label.TextProperty, "Name");
label.BindingContext = new {Name = "John Doe", Company = "Xamarin"};
Debug.WriteLine (label.Text); //prints "John Doe"
        ]]></code>
          </example>
        </remarks>
      </Docs>
    </Member>
    <Member MemberName="SetBinding">
      <MemberSignature Language="C#" Value="public static void SetBinding (this Xamarin.Forms.BindableObject self, Xamarin.Forms.BindableProperty targetProperty, string path, Xamarin.Forms.BindingMode mode = Xamarin.Forms.BindingMode.Default, Xamarin.Forms.IValueConverter converter = null, string stringFormat = null);" />
      <MemberSignature Language="ILAsm" Value=".method public static hidebysig void SetBinding(class Xamarin.Forms.BindableObject self, class Xamarin.Forms.BindableProperty targetProperty, string path, valuetype Xamarin.Forms.BindingMode mode, class Xamarin.Forms.IValueConverter converter, string stringFormat) cil managed" />
      <MemberType>Method</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>1.2.0.0</AssemblyVersion>
        <AssemblyVersion>1.3.0.0</AssemblyVersion>
        <AssemblyVersion>1.4.0.0</AssemblyVersion>
        <AssemblyVersion>1.5.0.0</AssemblyVersion>
        <AssemblyVersion>2.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>System.Void</ReturnType>
      </ReturnValue>
      <Parameters>
        <Parameter Name="self" Type="Xamarin.Forms.BindableObject" RefType="this" />
        <Parameter Name="targetProperty" Type="Xamarin.Forms.BindableProperty" />
        <Parameter Name="path" Type="System.String" />
        <Parameter Name="mode" Type="Xamarin.Forms.BindingMode" />
        <Parameter Name="converter" Type="Xamarin.Forms.IValueConverter" />
        <Parameter Name="stringFormat" Type="System.String" />
      </Parameters>
      <Docs>
        <param name="self">The <see cref="T:Xamarin.Forms.BindableObject" />.</param>
        <param name="targetProperty">The BindableProperty on which to set a bindinge.</param>
        <param name="path">A <see cref="T:System.String" /> indicating the property path to bind to.</param>
        <param name="mode">The <see cref="T:Xamarin.Forms.BindingMode" /> for the binding. This parameter is optional. Default is <see cref="E:Xamarin.Forms.BindingMode.Default" />.</param>
        <param name="converter">An <see cref="T:Xamarin.Forms.IValueConverter" /> for the binding. This parameter is optional. Default is <see langword="null" />.</param>
        <param name="stringFormat">A string used as stringFormat for the binding. This parameter is optional. Default is <see langword="null" />.</param>
        <summary>Creates and applies a binding to a property.</summary>
        <remarks>
          <para>The following example shows how to use the extension method to set a binding.</para>
          <example>
            <code lang="C#"><![CDATA[
var label = new Label ();
label.SetBinding (Label.TextProperty, "Name");
label.BindingContext = new {Name = "John Doe", Company = "Xamarin"};
Debug.WriteLine (label.Text); //prints "John Doe"
      ]]></code>
          </example>
        </remarks>
      </Docs>
    </Member>
    <Member MemberName="SetBinding&lt;TSource&gt;">
      <MemberSignature Language="C#" Value="public static void SetBinding&lt;TSource&gt; (this Xamarin.Forms.BindableObject self, Xamarin.Forms.BindableProperty targetProperty, System.Linq.Expressions.Expression&lt;Func&lt;TSource,object&gt;&gt; sourceProperty, Xamarin.Forms.BindingMode mode = Xamarin.Forms.BindingMode.Default, Xamarin.Forms.IValueConverter converter = null, string stringFormat = null);" />
      <MemberSignature Language="ILAsm" Value=".method public static hidebysig void SetBinding&lt;TSource&gt;(class Xamarin.Forms.BindableObject self, class Xamarin.Forms.BindableProperty targetProperty, class System.Linq.Expressions.Expression`1&lt;class System.Func`2&lt;!!TSource, object&gt;&gt; sourceProperty, valuetype Xamarin.Forms.BindingMode mode, class Xamarin.Forms.IValueConverter converter, string stringFormat) cil managed" />
      <MemberType>Method</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>1.0.0.0</AssemblyVersion>
        <AssemblyVersion>1.1.0.0</AssemblyVersion>
        <AssemblyVersion>1.2.0.0</AssemblyVersion>
        <AssemblyVersion>1.3.0.0</AssemblyVersion>
        <AssemblyVersion>1.4.0.0</AssemblyVersion>
        <AssemblyVersion>1.5.0.0</AssemblyVersion>
        <AssemblyVersion>2.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <Attributes>
        <Attribute>
          <AttributeName>System.Obsolete</AttributeName>
        </Attribute>
      </Attributes>
      <ReturnValue>
        <ReturnType>System.Void</ReturnType>
      </ReturnValue>
      <TypeParameters>
        <TypeParameter Name="TSource" />
      </TypeParameters>
      <Parameters>
        <Parameter Name="self" Type="Xamarin.Forms.BindableObject" RefType="this" />
        <Parameter Name="targetProperty" Type="Xamarin.Forms.BindableProperty" />
        <Parameter Name="sourceProperty" Type="System.Linq.Expressions.Expression&lt;System.Func&lt;TSource,System.Object&gt;&gt;" />
        <Parameter Name="mode" Type="Xamarin.Forms.BindingMode" />
        <Parameter Name="converter" Type="Xamarin.Forms.IValueConverter" />
        <Parameter Name="stringFormat" Type="System.String" />
      </Parameters>
      <Docs>
        <typeparam name="TSource">The source type.</typeparam>
        <param name="self">The BindableObject.</param>
        <param name="targetProperty">The BindableProperty to bind to</param>
        <param name="sourceProperty">An expression used to retrieve the source path.</param>
        <param name="mode">The BindingMode for the binding. This parameter is optional. Default is <see cref="E:Xamarin.Forms.BindingMode.Default" />.</param>
        <param name="converter">An IValueConverter for the binding. This parameter is optional. Default is <see langword="null" />.</param>
        <param name="stringFormat">A string used as stringFormat for the binding. This parameter is optional. Default is <see langword="null" />.</param>
        <summary>Creates and applies a binding from an expression.</summary>
        <remarks>
          <para>This extension method uses Expression instead of path to creates and sets bindings. Using Expressions is more refactoring friendly.</para>
          <para>This following example illustrates the setting of a binding using the extension method.</para>
          <example>
            <code lang="C#"><![CDATA[
public class PersonViewModel
{
  public string Name { get; set; }
  public string Company { get; set; }
}

var label = new Label ();
label.SetBinding<PersonViewModel> (Label.TextProperty, vm => vm.Name);
label.BindingContext = new PersonViewModel {
  Name = "John Doe", 
  Company = "Xamarin"
};
Debug.WriteLine (label.Text); //prints "John Doe"
      ]]></code>
          </example>
        </remarks>
      </Docs>
    </Member>
  </Members>
</Type>