在silverlight中,你可以綁定到包含參數的屬性嗎?例如,以下內容似乎不起作用。我錯過了什麼,或者這是不可能的?您可以將數據綁定到包含Silverlight參數的屬性嗎?
C#
private System.Collections.Generic.Dictionary<string, string> ValuesField = new System.Collections.Generic.Dictionary<string, string>();
public string Value {
get { return ValuesField(FieldName); }
set { ValuesField(FieldName) = value; }
}
VB
Private ValuesField As New System.Collections.Generic.Dictionary(Of String, String)
Public Property Value(ByVal FieldName As String) As String
Get
Return ValuesField(FieldName)
End Get
Set(ByVal value As String)
ValuesField(FieldName) = value
End Set
End Property
XAML
<TextBox Name="TextBox1" VerticalAlignment="Top" Width="120"Text="{Binding Path=Value[MyField],Mode=TwoWay }" />
您可以擴展如何做到這一點嗎? – 2011-03-03 15:08:58