【问题标题】:Silverlight 5 app: Error 12 The tag 'Binding' does not exist in XML namespace 'http://schemas.microsoft.com/winfx/2006/xaml/presentation'Silverlight 5 应用程序:错误 12 XML 命名空间“http://schemas.microsoft.com/winfx/2006/xaml/presentation”中不存在标记“绑定”
【发布时间】:2012-09-27 23:25:14
【问题描述】:

我通过 VS2010 制作了一个简单的 Silverlight 5 应用程序,以在我的组织的业务应用程序中跟踪 Silverlight 4 到 Silverlight 5 转换问题中的更大问题。

这是应用的客户端部分:

<UserControl x:Class="SilverlightApplication1.MainPage" 
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             mc:Ignorable="d" 
             d:DesignHeight="300"  
             d:DesignWidth="400"> 

    <StackPanel> 

        <TextBlock 
                Text="{Binding Path=Rate}" 
                Grid.Column="1" 
                Grid.Row="1" 
                x:Name="xTest" 
                FontSize="12" 
                Margin="166,0,0,44" 
                HorizontalAlignment="Left" 
                Foreground="Black" 
                VerticalAlignment="Bottom"> 
        </TextBlock> 

    </StackPanel> 
</UserControl> 

代码隐藏:

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Net; 
using System.Windows; 
using System.Windows.Controls; 
using System.Windows.Documents; 
using System.Windows.Input; 
using System.Windows.Media; 
using System.Windows.Media.Animation; 
using System.Windows.Shapes; 

namespace SilverlightApplication1 
{ 
    public partial class MainPage : UserControl 
    { 
        public MainPage() 
        { 
            InitializeComponent(); 
            Rate = 25; 
        } 

        public int Rate { get; set; } 
    } 
}

应用运行结果:

错误 12 XML 命名空间“http://schemas.microsoft.com/winfx/2006/xaml/presentation”中不存在标记“Binding”。 C:\source\sl5_test_app\SilverlightApplication1\SilverlightApplication1\MainPage.xaml 13 24 SilverlightApplication1

其他信息:

如果我改变...

Text="{Binding Path=Rate}"

到...

Text="25"

...应用程序运行并在屏幕上显示“25”。


我已经在网上搜索了这个原因,但没有任何投资回报。由于这个通用的 Silverlight 异常,有大量类似的查询将 'binding' 替换为 'XXX' 或 '[Some_Control]',但到目前为止还没有解决这个问题。

这里缺少什么?

谢谢你, 亚伦

【问题讨论】:

    标签: silverlight binding


    【解决方案1】:

    我最终炸毁了我的操作系统,然后安装了新版本的 Windows Server 2008 R2、Visual Studio 2010 和所有相关的 Silverlight 组件。

    现有或新 Silverlight 项目不再出现绑定错误。

    -亚伦

    【讨论】:

      猜你喜欢
      • 2014-10-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-07-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多