Silverlight TabItem 模板无法正常工作
在 SL4 应用程序中,我需要重新设计 TabItems 的样式(实际上在标题中添加一个按钮)。
所以我从这里获取了TabItem的控件模板 并添加了我想要的功能。
这似乎工作正常,(我可以动态添加选项卡项),但有一个例外: 我认为这个发布的控件模板的行为在某种程度上是“任意的”:每次鼠标悬停在未选择的 TabItem 标题上时,都会在不单击的情况下选择它! (据我所知,这不是默认行为:用户必须单击标题才能使该选项项成为选定选项)。
我试图找出它为什么会这样,但没有运气! 有没有人可以照亮我的黑暗???
提前致谢!
In a SL4 application i need to restyle my TabItems (actually add a button in the header).
So i took the TabItem's control template from here and added the functionality i wanted.
This seems to work fine, (i could dynamically add tabitems) with one exception:
i think this posted control template is behaving somehow "arbitrary": every time the mouse hoovers over a non selected TabItem header, this gets selected WHITHOUT clicking!! (afaik this is not the default behavior: the user user has to click a header to make this tabitem the selected one).
I tried to find why it is behaving like this, with no luck!
Is there someone who can enlighten my darkness???
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事实证明,错误不在控件模板中,而是在应用样式的类中。
详细信息:应用样式的类如下(在其中您将看到我关于“错误行为”的评论):
public class WorkspaceViewModel : TabItem
{
Well it turns out the error was not in the control template but in the class, the style was applied to.
In detail: the class the style was applied to is the following (in it you will see my comment about the "wrong behavior"):
public class WorkspaceViewModel : TabItem
{