码迷,mamicode.com
首页 > Windows程序 > 详细

WPF样式学习:ToolBar的使用

时间:2017-07-19 17:54:16      阅读:334      评论:0      收藏:0      [点我收藏+]

标签:log   dna   loaded   bsp   horizon   obj   学习   flow   隐藏   

隐藏拖动把手:

设置ToolBar属性 ToolBarTray.IsLocked="True",可以达到隐藏拖动把手的目的

private void ToolBar_Loaded(object sender, RoutedEventArgs e)
{
    //去掉ToolBar右边默认的扩展图标
    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);
    }
}    

  <ToolBar x:Name="tbStuRelay"  Width="120" ToolBarTray.IsLocked="True" Background="#008ede" HorizontalAlignment="Stretch"  VerticalAlignment="Center"  VerticalContentAlignment="Center" Loaded="ToolBar_Loaded" MouseMove="ToolBar_MouseMove" Visibility="Collapsed">

     </ToolBar>

WPF样式学习:ToolBar的使用

标签:log   dna   loaded   bsp   horizon   obj   学习   flow   隐藏   

原文地址:http://www.cnblogs.com/candyzhmm/p/7206560.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!