删除手风琴项目箭头和默认背景颜色?

发布于 2024-12-22 14:44:44 字数 131 浏览 2 评论 0原文

我正在使用 WPFToolkit 中的手风琴,并且当我尝试在 Expression Blend4 中编辑它时也想删除手风琴项目箭头,但它不允许我在那里。因此,如果有人可以帮助提供示例模板,我如何隐藏箭头和默认的蓝色背景。

提前致谢。

I am using Accordion from WPFToolkit and wanted to remove the accordion item arrow also when i am trying to edit it in Expression Blend4 then it does not allow me over there. So if anybody can help with a sample template how can i hide the arrow and the default blue background.

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

眼藏柔 2024-12-29 14:44:44

您只需编辑控件样式即可。这个示例来自 Silverlight 工具包,但我敢打赌它的原理都是相同的。

1) 删除箭头

我有一个名为 toolkitStyles.xaml 的文件,其中定义了以下样式。

<Style TargetType="layouttoolkit:AccordionButton" x:Key="DefaultAccordionButtonStyle">

在这种样式中(您必须寻找它),您将找到类似于此的代码

<Path x:Name="arrow" Data="F1 M 301.14,-189.041L 311.57,-189.041L 306.355,-182.942L 301.14,-189.041 Z " HorizontalAlignment="Center" Height="5" Stretch="Uniform" Width="8" Fill="{StaticResource BlackBrush}" RenderTransformOrigin="0.5,0.5" VerticalAlignment="Center">

将其注释掉,然后搜索 x:Name(它可能不是 WPFToolkit 中的“箭头”)并删除任何内容引用它以便您可以构建它。

2) 删除蓝色背景

找到像这样的样式

<Style TargetType="System_Windows_Controls:AccordionItem" x:Key="DefaultAccordionItemStyle">

。它可能接近样式的底部。
(请注意,在我的中,我已经设置了背景=“透明”,你的背景要么是蓝色,要么是模板绑定,无论哪种方式,只需将其设置为透明或任何你想要的颜色)

<layouttoolkit:AccordionButton x:Name="ExpanderButton" Background="Transparent" ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" Foreground="{TemplateBinding Foreground}" FontWeight="{TemplateBinding FontWeight}" FontStyle="{TemplateBinding FontStyle}" FontStretch="{TemplateBinding FontStretch}" FontSize="{TemplateBinding FontSize}" FontFamily="{TemplateBinding FontFamily}" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" IsTabStop="True" IsChecked="{TemplateBinding IsSelected}" Margin="0,0,0,0" Padding="0,0,0,0" Grid.Row="0" VerticalAlignment="{TemplateBinding VerticalAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>

You can just edit the control style. This example is from Silverlight toolkit, but I'd bet its all the same principals.

1) Remove Arrow

I have a file called toolkitStyles.xaml in which I have the following style defined.

<Style TargetType="layouttoolkit:AccordionButton" x:Key="DefaultAccordionButtonStyle">

Inside this style (you will have to hunt for it), you'll find code similar to this

<Path x:Name="arrow" Data="F1 M 301.14,-189.041L 311.57,-189.041L 306.355,-182.942L 301.14,-189.041 Z " HorizontalAlignment="Center" Height="5" Stretch="Uniform" Width="8" Fill="{StaticResource BlackBrush}" RenderTransformOrigin="0.5,0.5" VerticalAlignment="Center">

Comment it out, and then to a search on the x:Name (it might not be "arrow" in the WPFToolkit) and remove anything that references it so that you can build it.

2) Remove blue background

Find the style like

<Style TargetType="System_Windows_Controls:AccordionItem" x:Key="DefaultAccordionItemStyle">

Find the line like this. It is probably near the bottom of the style.
(Please note in mine I have already set Background="Transparent", yours will either be blue or a templatebinding, either way just set it to transparent or whatever color you want it)

<layouttoolkit:AccordionButton x:Name="ExpanderButton" Background="Transparent" ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" Foreground="{TemplateBinding Foreground}" FontWeight="{TemplateBinding FontWeight}" FontStyle="{TemplateBinding FontStyle}" FontStretch="{TemplateBinding FontStretch}" FontSize="{TemplateBinding FontSize}" FontFamily="{TemplateBinding FontFamily}" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" IsTabStop="True" IsChecked="{TemplateBinding IsSelected}" Margin="0,0,0,0" Padding="0,0,0,0" Grid.Row="0" VerticalAlignment="{TemplateBinding VerticalAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文