Silverlight 4:制作可关联的标题

Silverlight 4:制作可关联的标题,第1张

概述我想扩展选项卡控件以具有可关闭的选项卡项. 我找到了Kent的这个WPF解决方案: On the WPF TabControl – can I add content next to the tab headers? 我在Blend中打开了现有silverlight tabcontrol的副本.但是,该结构与WPF tabcontrol看起来完全不同.我无法直接进入Silverlight控件模板. 我想扩展选项卡控件以具有可关闭的选项卡项.

我找到了Kent的这个WPF解决方案:
On the WPF TabControl – can I add content next to the tab headers?

我在Blend中打开了现有silverlight tabcontrol的副本.但是,该结构与WPF tabcontrol看起来完全不同.我无法直接进入Silverlight控件模板.

有谁知道我的好资源?

解决方法 您可以使用Template TabItem来设置某种关闭按钮,您可以在后面的代码中挂钩以关闭当前选定的选项卡.

<Style targettype="TabItem">            <Setter.Value>                <ControlTemplate targettype="sdk:TabItem">                            <button x:name="PART_btnClose"                                            Height="15"                                            WIDth="15"                                            GrID.Column="1"                                            HorizontalAlignment="Right"                                            VerticalAlignment="Center"                                            margin="20,3,8" borderThickness="1" Cursor="Hand" /></ControlTemplate></Setter.Value></Style>

在此之后,在应用模板上,您可以订阅buttonClicked事件.

像这样的东西:

public overrIDe voID OnApplyTemplate()    {        base.OnApplyTemplate();        PART_btnClose = GetTemplateChild("PART_btnClose") as button;        if (PART_btnClose != null)        {            PART_btnClose.Click += new RoutedEventHandler(PART_btnClose_Click);        }

在那种情况下,您可以关闭标签.

希望这会有所帮助,代码可能无法正常工作,只是快速完成.

Ty Rozak

总结

以上是内存溢出为你收集整理的Silverlight 4:制作关联标题全部内容,希望文章能够帮你解决Silverlight 4:制作可关联的标题所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1078849.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-27
下一篇2022-05-27

发表评论

登录后才能评论

评论列表(0条)

    保存