The capture can be removed by setting the attached property ToolBarTray.IsLocked="True" in the ToolBar.
To remove the Overflow ToggleButton , you will need to remove it in a custom ControlTemplate, as the sixlettervariables suggestion suggests, which if you have a mix or you can download Preview Blend 3 is not too complicated.
You can also simply hide the button in the loaded ToolBar event, although no matter which route you choose, you must also set the attached property ToolBar.OverflowMode="Never" in the ToolBar menu so that the elements cannot accidentally overflow into an inaccessible area.
<ToolBarPanel DockPanel.Dock="Top"> <ToolBar ToolBarTray.IsLocked="True" Loaded="ToolBar_Loaded"> <Menu ToolBar.OverflowMode="Never"> <MenuItem Header="File" /> <MenuItem Header="New" /> </Menu> </ToolBar> </ToolBarPanel>
And set the OverflowButton overflow:
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(); } }
rmoore Jun 26 '09 at 20:57 2009-06-26 20:57
source share