This project has moved. For the latest updates, please go here.

DropDownButton, My Style kills my DropDown-Ability

Dec 19, 2013 at 12:18 PM
I`m using the Dropdownbutton

My Problem is, that i defined the template in my style. By doing this my button lost his "dropdown ability" so he acts like a simple normal button..
    <Style x:Key="StandardDropDownButton" TargetType="{x:Type toolkit:DropDownButton}">
        <Setter Property="Background" Value="{StaticResource NormalBackground}" />
        <Setter Property="Foreground" Value="#000000" />
        <Setter Property="FontSize" Value="11" />
        <Setter Property="FontFamily" Value="Microsoft Sans Serif" />
        <Setter Property="TextOptions.TextRenderingMode" Value="Aliased" />
        <Setter Property="TextOptions.TextFormattingMode" Value="Display" />
        <Setter Property="Template">
                <ControlTemplate TargetType="{x:Type toolkit:DropDownButton}" >
                    <Grid >
                        <Border x:Name="OuterBd" CornerRadius="3" BorderBrush="{StaticResource BorderNormal}" BorderThickness="1" Background="{StaticResource NormalBackground}">
                            <Border x:Name="InnerBd" Padding="5,0,5,0" CornerRadius="3" BorderBrush="{StaticResource BorderNormal}" BorderThickness="0">
                                <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" RecognizesAccessKey="True" VerticalAlignment="Center" />
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter TargetName="OuterBd" Property="BorderBrush" Value="{StaticResource BorderOver}" />
                        <Trigger Property="IsKeyboardFocused" Value="true">
                            <Setter TargetName="InnerBd" Property="BorderBrush" Value="{StaticResource BorderOver}" />
what can i do against this?
Dec 19, 2013 at 3:28 PM

You are redefining the controlTemplate of the DropDownButton. So you are modifying the behavior of the DropDownButton to act as you defined it. To keep the Behavior of the DropDownButton from the toolkit, you need to keep the controlTemplate of the DropDownButton and start your modification from this one. Here is where you can find the ControlTemplate of the Toolkit's DropButton :
In windows7 : Xceed.Wpf.Toolkit/DropDownButton/Themes/Generic.xaml
In windows8 : Xceed.Wpf.Toolkit/DropDownButton/Themes/Aero2.NormalColor.xaml