Search code examples
wpftoolstriptoolstripbutton

Is there a WPF equivalent for ToolStripButton?


I'm learning WPF and have been trying to create a toolstrip. Is there a direct equivalent of the WinForms ToolStripButton or is the correct way of use just to add a normal button and format it?

I've found that Microsoft have a page that lists WinForm controls and their WPF equivalents here but that doesn't mention the toolstripbutton.


Solution

  • You can just put buttons inside a ToolBar and it will change the style of the buttons to make them look like a toolbar.

    <ToolBar>
        <Button>Save</Button>
        <Button>Open</Button>
    </ToolBar>
    

    Looks like this:

    enter image description here

    If you want images in the buttons, you have to do the normal thing of modifying the content of the button.

    <Button>
        <Image Source="..." />
    </Button>