开发者

Error in Visual Studio 2010 designer when binding using StringFormat

I'm using Silverlight and in my xaml I try to bind an Image source with StringFormat like the example in WPF Image Dynamically changing Image source during runt开发者_如何学JAVAime

But when I add '&' in my URL there is an error saying: System.FormatException was thrown on "ProductView.xaml": Index (zero based) must be greater than or equal to zero and less than the size of the argument list.

This is my Image tag i xaml:

<Image Width="100" Height="100" Source="{Binding Image.ResourceFileId, StringFormat='http://URL/images?id={0}&amp;format=thumbnail'}" />

There is no error when removing the '&amp;'-part, and the application compiles and runs both with and without the '&amp;'-part. It is only an error in the designer, but the effect is that IntelliSense no longer seems to work when this error is "active".

Does anyone have an explanation for this?


I think the braces are what is giving you a problem. It should look like this instead:

StringFormat='http://URL/images?id=\{0\}&amp;format=thumbnail'
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜