【问题标题】:Error in Visual Studio 2010 designer when binding using StringFormat使用 StringFormat 绑定时 Visual Studio 2010 设计器中的错误
【发布时间】:2011-06-10 04:28:49
【问题描述】:

我正在使用 Silverlight,在我的 xaml 中,我尝试将图像源与 StringFormat 绑定,就像WPF Image Dynamically changing Image source during runtime 中的示例一样

但是当我添加 '&'在我的网址中有一个错误说: System.FormatException 在“ProductView.xaml”上引发:索引(从零开始)必须大于或等于零且小于参数列表的大小。

这是我的图片标签 i xaml:

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

删除“&”部分时没有错误,应用程序在有和没有“&”部分的情况下都可以编译和运行。这只是设计器中的一个错误,但效果是当此错误“活动”时,IntelliSense 似乎不再起作用。

有人对此有解释吗?

【问题讨论】:

    标签: silverlight visual-studio-2010 data-binding string-formatting


    【解决方案1】:

    我认为大括号会给你带来问题。它应该看起来像这样:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-06-29
      • 1970-01-01
      • 2013-08-18
      • 1970-01-01
      • 1970-01-01
      • 2011-03-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多