WPF ToolBar:如何在设计时安排工具栏

tpo*_*pol 5 wpf toolbar

我在一个ToolBarTray中有两个Wpf工具栏.如何让它们适合两排?

我注意到用户可以在运行时移动它们.有没有办法在设计时获得相同的行为而不使用两个ToolBarTrays?



为了sumarize,在启动时,我想要这样:

替代文字

而不是:

替代文字

谢谢

Zam*_*oni 5

使用Band和BandIndex控制工具栏布局.

    <ToolBarTray Background="White">
        <ToolBar Band="1" BandIndex="1">
            <Button Content="B1"/>
            <Button Content="B2"/>
            <Button Content="B3"/>
        </ToolBar>
        <ToolBar Band="2" BandIndex="1">
            <Button Content="B4"/>
            <Button Content="B5"/>
        </ToolBar>
        <ToolBar Band="2" BandIndex="2">
            <Button Content="B6"/>
            <Button Content="B7"/>
        </ToolBar>
    </ToolBarTray>
Run Code Online (Sandbox Code Playgroud)