Silverlight TabControl 继承在表达式混合中失败
我通过 Visual Studio 创建了一个基本的 TemplatedControl。然后我继承 TabControl 而不是 Control。从技术上讲,它是有效的(即通过编译),但在 Expression Blend 3 中,我收到错误“对象引用未设置为对象的实例”。
然后,如果我单击 TabItem 本身,错误就会消失?有人经历过这个吗?
我在一个全新的项目上测试了这个,除了自定义选项卡控件之外没有任何东西,并且发生了同样的事情(所以它很可能是一个表达式错误?)
代码在这里:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
namespace Riagenic.UXLib.Controls.Chrome
{
public class ChromeTabControl : TabControl
{
public ChromeTabControl() : base()
{
this.DefaultStyleKey = typeof(ChromeTabControl);
}
}
}
I create a basic TemplatedControl via Visual Studio. I then inherit TabControl instead of Control. It technically works (ie passes compile) but inside Expression Blend 3, I get an error " object reference not set to an instance of an object".
Then if i click on the TabItem itself, the error goes away? anyone experience this?
I tested this out on a brand new project with nothing it other than a custom tab control and same thing happens (so it could very well be an expression bug?)
Code is here:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
namespace Riagenic.UXLib.Controls.Chrome
{
public class ChromeTabControl : TabControl
{
public ChromeTabControl() : base()
{
this.DefaultStyleKey = typeof(ChromeTabControl);
}
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事实证明,这是 Expression Blend 3 中的一个错误。解决方法(通过 Peter Blois - Expression Blend 和 rockstar 的项目经理)表示将其落实到位:
It turns out it was a bug in Expression Blend 3. Work around (Via Peter Blois - Program Manager on Expression Blend and rockstar) says to put this in place: