混合3 RC中的错误无法解析静态类|设计师例外 [英] Bug in Blend 3 RC | Unable to resolve a static class | designer exception

查看:48
本文介绍了混合3 RC中的错误无法解析静态类|设计师例外的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

重现此问题:
1-在Blend 3中创建一个新的WPF项目
2-复制并粘贴以下C#代码作为新类:

公共静态类LookupTablesCache
{
公共静态字符串Abc;
}

3-打开Window1 Xaml并复制并粘贴跟随xaml:

< Window.Resources>
< DataTemplate>
< TextBox Margin =" 142,116,236,0" VerticalAlignment = QUOT;陀螺"高度= QUOT; 40" TextWrapping =" Wrap"
Text =" {Binding Source = { x:Static test:LookupTablesCache.Abc }}" />
< / DataTemplate>
< /Window.Resources>

< Grid x:Name =" LayoutRoot">
< TextBox Margin =" 142,116,236,0" VerticalAlignment = QUOT;陀螺"高度= QUOT; 40" TextWrapping =" Wrap"
Text =" {Binding Source = { x:Static test:LookupTablesCache.Abc }}" />
< / Grid>

你会注意到第一个"x:静态测试:LookupTablesCache.Abc"下的链接表示无效的xaml,而第二个没有问题

To reproduce the issue:
1- Create a new WPF project in Blend 3
2- Copy and paste the following C# code as a new class:

 public static class LookupTablesCache
 {
  public static string Abc;
 }

3- Open the Window1 Xaml and copy and paste the following xaml:

<Window.Resources>
<DataTemplate>
  <TextBox Margin="142,116,236,0" VerticalAlignment="Top" Height="40"  TextWrapping="Wrap"
  Text="{Binding Source={x:Static test:LookupTablesCache.Abc}}"/>
</DataTemplate>
</Window.Resources>

 <Grid x:Name="LayoutRoot">
  <TextBox Margin="142,116,236,0" VerticalAlignment="Top" Height="40"  TextWrapping="Wrap"
  Text="{Binding Source={x:Static test:LookupTablesCache.Abc}}"/>
 </Grid>

You will notice a link under the first "x:Static test:LookupTablesCache.Abc" saying invalid xaml, while the second one will work with no problems

预期结果:
设计人员必须能够在数据模板中解析x:static标记,xaml是正确的,混合3设计者无法解决它。
我们也注意到了一个问题对于嵌套模板中的图像,设计人员尝试从blend.exe而不是应用程序加载图像,看起来数据模板在内部以不同的方式处理。

Expected results:
The designer must be able to resolve the x:static markup when in the data template, the xaml is correct, the blend 3 designer is not able to resolve it.
We also noticed a problem with the images in nested templates, the designer tries to load the images from blend.exe instead of the application, it looks like the data templates are treated internally in a different way.

推荐答案

尝试运行此项目时,我们得到以下异常。你确定这在运行时运行正常吗?

XamlParseException:无法将属性'Source'中的值转换为'System.Windows.Markup.StaticExtension'类型的对象。标记文件'WpfApplication3; component / mainwindow.xaml'中对象'System.Windows.Data.Binding'出错'第19行位置3.

谢谢,
Unni
When trying to run this project, we get the following exception. Are you sure this is something that works fine at runtime?

XamlParseException: Cannot convert the value in attribute 'Source' to object of type 'System.Windows.Markup.StaticExtension'.  Error at object 'System.Windows.Data.Binding' in markup file 'WpfApplication3;component/mainwindow.xaml' Line 19 Position 3.

Thanks,
Unni


这篇关于混合3 RC中的错误无法解析静态类|设计师例外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆