wpf - 如何在 Windows 10 上为 WPF 应用程序的工具栏查找默认图标?
问题描述
此Microsoft 文档的Editing Commands
部分在顶部显示了一个工具栏,上面带有. 但是文档没有描述这些图标在系统上的位置。当我将它们复制到我的项目中时,它会给出如下所示的错误。问题:我怎样才能找到我的那些图标(如下图所示)?WPF
RichTextBox
Bullets, Numbering, Indents etc
XAML
Windows 10
错误[我的项目中 XAML 页面的屏幕截图。单击图像以获得更好的视图]:
来自Microsoft 示例的图像:
解决方案
图像补丁应使用斜杠 (/) 而不是反斜杠 ()。图像应位于项目根目录下的图像文件夹中。
<Window x:Class="RichTextBoxInputPanelDemo.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Height="400" Width="600"
>
<Grid>
<!-- Set the styles for the tool bar. -->
<Grid.Resources>
<Style TargetType="{x:Type Button}" x:Key="formatTextStyle">
<Setter Property="FontFamily" Value="Palatino Linotype"></Setter>
<Setter Property="Width" Value="30"></Setter>
<Setter Property="FontSize" Value ="14"></Setter>
<Setter Property="CommandTarget" Value="{Binding ElementName=mainRTB}"></Setter>
</Style>
<Style TargetType="{x:Type Button}" x:Key="formatImageStyle">
<Setter Property="Width" Value="30"></Setter>
<Setter Property="CommandTarget" Value="{Binding ElementName=mainRTB}"></Setter>
</Style>
</Grid.Resources>
<DockPanel Name="mainPanel">
<!-- This tool bar contains all the editing buttons. -->
<ToolBar Name="mainToolBar" Height="30" DockPanel.Dock="Top">
<Button Style="{StaticResource formatImageStyle}" Command="ApplicationCommands.Cut" ToolTip="Cut">
<Image Source="Images/EditCut.png"></Image>
</Button>
</ToolBar>
<!-- By default pressing tab moves focus to the next control. Setting AcceptsTab to true allows the
RichTextBox to accept tab characters. -->
<RichTextBox Name="mainRTB" AcceptsTab="True"></RichTextBox>
</DockPanel>
</Grid>
</Window>
推荐阅读
- node.js - 使用 --mount 标志时 Docker 容器不运行
- android - 为什么我的 onCreateView 中的 WebView 代码无法访问?
- python - 如何在绿龙渲染中获取剪辑距离和纹理
- python - 删除链表中所有重复的元素
- android - 错误:无法解决:com.github.imperiumlabs:GeoFirestore-Android:v1.5.0
- tensorflow - RGB图像上的Tensorflow conv2d
- r - 在R中覆盖2张具有透明度的图像
- python - 当有很多字段时管理 django 的创建方法
- c# - 在满足条件之前查找值
- reactjs - Webpack在构建后删除片段代码,如何保留它?