【问题标题】:Changing position of arrow on AccordionButton更改 AccordionButton 上箭头的位置
【发布时间】:2014-11-20 12:47:05
【问题描述】:

我的任务很简单:我想将 Silverlight Accordion 控件上的小箭头移动到顶部而不是居中。事实证明这比我预期的要复杂。 (我还是 XAML 的新手,没有 Expression Blend)。

到目前为止,我已经推断出我需要修改 AccordionButton 的样式。我已经成功地为 AccordionItem 本身添加了 Style 并且一切正常,但是当我尝试修改按钮本身时没有任何反应。

<Style TargetType="toolkit:AccordionButton" x:Key="MyAccordionButtonStyle">
    <Setter Property="VerticalContentAlignment" Value="Top"></Setter>
    <Setter Property="VerticalAlignment" Value="Top"></Setter>
</Style>

我是否需要重做 AccordionButton 的整个样式才能使其正常工作?我找到了this answer,这似乎是我需要做的,但我不知道从哪里“复制模板”或者一旦找到它就把它放在哪里。我试图在 CodePlex 上找到源模板,但没有运气。我确实找到了this 第一个答案似乎有我正在寻找的东西,但我需要把它放在哪里才能工作?我不确定如何“连接它”,或者我是否以正确的方式进行此操作,对于如此简单的事情来说似乎过于复杂。

【问题讨论】:

  • 是的,这将替换您当前的样式,即使您没有 Blend 也可以找到模板e.g. Github

标签: c# xaml silverlight accordion


【解决方案1】:

首先,如果您还没有,请在根目录下创建一个名为“Themes”的文件夹

向该文件夹添加一个新文件“Generic.xaml”并将构建操作标记为“资源”

Generic.xaml 内容:

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
   xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
   xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
   xmlns:system="http://clr-namespace:System;assembly=mscorlib"
   >

   <Style TargetType="toolkit:AccordionButton" BasedOn="{StaticResource MyAccordionButtonStyle}"/>
</ResourceDictionary>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-06-01
    • 1970-01-01
    • 2017-02-05
    • 1970-01-01
    • 1970-01-01
    • 2013-09-30
    • 2020-12-08
    • 2021-06-10
    相关资源
    最近更新 更多