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}&format=thumbnail'}" />
There is no error when removing the '&'-part, and the application compiles and runs both with and without the '&'-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\}&format=thumbnail'
精彩评论