Wpf 如何在没有控件模板的情况下删除工具栏的圆角?
我尝试下一种方法:Wpf 如何在没有控件模板的情况下删除工具栏的圆角?,wpf,toolbar,Wpf,Toolbar,我尝试下一种方法: <ToolBar x:Name="toolBar" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Grid.Row="0"> <Button BorderBrush="Black" Content="READ" Click="Button_Click_1"/> <ToolBar.Resources> <
<ToolBar x:Name="toolBar" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Grid.Row="0">
<Button BorderBrush="Black" Content="READ" Click="Button_Click_1"/>
<ToolBar.Resources>
<Style x:Key="ToolBarMainPanelBorderStyle" TargetType="{x:Type Border}">
<Setter Property="CornerRadius" Value="0,0,0,0"/>
</Style>
</ToolBar.Resources>
</ToolBar>
它不起作用。我不想使用模板更改整个工具栏的样式。如何操作?将您的
工具栏
放在工具栏托盘
中即可实现,如下所示:
<ToolBarTray>
<ToolBar x:Name="toolBar" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Grid.Row="0">
<Button BorderBrush="Black" Content="READ" Click="Button_Click_1"/>
<ToolBar.Resources>
<Style x:Key="ToolBarMainPanelBorderStyle" TargetType="{x:Type Border}">
<Setter Property="CornerRadius" Value="0,0,0,0"/>
</Style>
</ToolBar.Resources>
</ToolBar>
</ToolBarTray>
将您的
工具栏
放在工具栏托盘
内即可实现,如下所示:
<ToolBarTray>
<ToolBar x:Name="toolBar" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Grid.Row="0">
<Button BorderBrush="Black" Content="READ" Click="Button_Click_1"/>
<ToolBar.Resources>
<Style x:Key="ToolBarMainPanelBorderStyle" TargetType="{x:Type Border}">
<Setter Property="CornerRadius" Value="0,0,0,0"/>
</Style>
</ToolBar.Resources>
</ToolBar>
</ToolBarTray>
您希望命名资源在没有显式分配的情况下如何工作?我希望xaml中的决策或代码落后您希望命名资源在没有显式分配的情况下如何工作?我希望xaml中的决策或代码落后欢迎@SQLprogIt正在向按钮添加“边缘”边框,而不是更改工具栏的圆形边框,因此我很惊讶这解决了问题。您可以提供您的决定。我会考虑的。欢迎!SQLprogIt正在向按钮添加“边缘”边框,而不是更改工具栏的圆形边框,因此我很惊讶这解决了问题。您可以提供您的决定。我会考虑的。