开发者

WPF Menu arrow on the first level

Help me please with wpf menu. I want the arrows showing that a menu item has also subitems. By default these arrows get placed beginning on the second level. but I want them to be shown on the first level also.

I don't clearly understand what to change and how. Although I found

<Trigger Property="Role" Value="SubmenuItem">

inside the item's template, but I couldn't that make to work for me.

UPD: I tried to do that:

 <Menu>
    <Menu.Resources>
       <Style TargetType="{x:Type MenuItem}">
            <Style.Triggers>
                <Trigger Property="Role" Value="TopLevelHeader">
                   <Setter Property="Template" Value="{DynamicResource {开发者_运维知识库ComponentResourceKey ResourceId=SubmenuHeaderTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}"/>
                </Trigger>
            </Style.Triggers>
        </Style>
    </Menu.Resources>
</Menu>

And now I have some crap like that:

WPF Menu arrow on the first level

You see I don't like the second element's offset. I don't know how to align that to the left. I tried to change Padding, Margin, HorizontalAlignment and HorizontalContentAligment - nothing helped.


Seems they aligned properly when icons added.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜