How to hide arrow on right side of a Toolbar?

mpen picture mpen · Jan 11, 2011 · Viewed 15.8k times · Source

Figured out how to hide the grippy dots on the left side, now how do I hide that add/remove buttons drop-down arrow on the right side?

Answer

Andrei Pana picture Andrei Pana · Jan 11, 2011

Google is full with the answer to this:

private void ToolBar_Loaded(object sender, RoutedEventArgs e)
{
    ToolBar toolBar = sender as ToolBar;
    var overflowGrid = toolBar.Template.FindName("OverflowGrid", toolBar) as FrameworkElement;
    if (overflowGrid != null)
    {
            overflowGrid.Visibility = Visibility.Collapsed;
    }

    var mainPanelBorder = toolBar.Template.FindName("MainPanelBorder", toolBar) as FrameworkElement;
    if (mainPanelBorder != null)
    {
        mainPanelBorder.Margin = new Thickness(0);
    }
}

And assign this method to your toolbar Loaded event.