简体   繁体   中英

WPF MahApps.Metro DropDownButton hide arrow

Is it possible to hide 'arrow' on MahApps.Metro DropDownButton?

Right now it looks like this:

我的按钮

And here's the code:

<controls1:DropDownButton
    VerticalContentAlignment="Center"

    Orientation="Vertical"
    DisplayMemberPath="Text"
    ItemsSource="{Binding MenuItems }">
    <controls1:DropDownButton.Style>
        <Style TargetType="controls1:DropDownButton">
            <Setter Property="Content">
                <Setter.Value>
                    <Image Source="{StaticResource More}"></Image>
                </Setter.Value>
            </Setter>
        </Style>
    </controls1:DropDownButton.Style>
    <controls1:DropDownButton.ItemContainerStyle>
        <Style TargetType="MenuItem">
            <Setter Property="Command" Value="{Binding Path=Command}" />
        </Style>
    </controls1:DropDownButton.ItemContainerStyle>
</controls1:DropDownButton>

Is it possible to remove this 'arrow'?

I have tried to replace Template but this removed functionality of DropDown.

Usually the easiest way to change Thrid Party Styles is by using the original style (or template) and override it by yourself. You will probably need to do this as I don't see a property to hide the arrow in their source code.

https://github.com/MahApps/MahApps.Metro/blob/master/MahApps.Metro/Themes/DropDownButton.xaml

Maybe you would also be able to use a Attached Property and try to hide the element (as it's a TemplatePart ).

you can set the ArrowVisibility attribute to collapsed

 <controls:DropDownButton Name="__BtExitApp"
                                         Orientation="Vertical"
                                         Content="Quit"                                                                           
                                 Grid.Column="2"
                                 x:FieldModifier="public"   
                                 Grid.Row="0" Grid.ColumnSpan="1" Margin="2,2,2,2"
                                 ArrowVisibility="Collapsed"
                                 >

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM