开发者

Complex binding in silverlight

I have the following property on my object

public Dictionary<string, Tuple开发者_如何学运维<string, bool>> AnswerOptions { get; set; }

I would like the Value of the dictionary to bind to the checkbox's isChecked property.

IsChecked="{Binding ((Tuple<string,bool>)Value).Item2}" which gives me an error.Pls help


Bindings use reflection to access properties and their values. You reference by property names only, or combined with numeric indexes (kind of like a path to the element name). You do not use C# casting.

I would need to know more about your model to get this right, but it will be more like:

IsChecked="{Binding Path=AnswerOptions[1].Value}"

But that will not work because of your data types.

Can you provide enough code to build a sample of your data object and more Xaml? Then I can provide something more useful to your specific example.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜