Can you data bind to a property that contains parameter in Silverlight?
Posted
by rip
on Stack Overflow
See other posts from Stack Overflow
or by rip
Published on 2010-04-14T10:44:19Z
Indexed on
2010/04/14
11:33 UTC
Read the original article
Hit count: 197
In silverlight, can you bind to a property that contains parameter? For example, the following doesn’t seem to work. Am I missing something or is this not possible?
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 }" />
© Stack Overflow or respective owner