“toolbar wpf nonaktifkan overflow” Kode Jawaban

toolbar wpf nonaktifkan overflow

<ToolBarPanel DockPanel.Dock="Top">
    <ToolBar ToolBarTray.IsLocked="True" Loaded="ToolBar_Loaded">
        <Menu ToolBar.OverflowMode="Never">
            <MenuItem Header="File" />
            <MenuItem Header="New" />
        </Menu>
    </ToolBar>
</ToolBarPanel>
Kingfisher

toolbar wpf nonaktifkan 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();
    }
}
Kingfisher

Jawaban yang mirip dengan “toolbar wpf nonaktifkan overflow”

Pertanyaan yang mirip dengan “toolbar wpf nonaktifkan overflow”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya