在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