如何在Windows 10 for WPF app工具栏上找到默认图标?

问题描述 投票:0回答:1

Editing Commandsthis部分WPF上的Microsoft文档在RichTextBox上显示了一个工具栏,其中包含Bullets, Numbering, Indents etc的默认图标。但是文档没有描述这些图标在系统中的位置。当我在我的项目中复制他们的XAML时,它会给出如下所示的错误。问题:如何在我的Windows 10上找到这些图标(如下图所示)?

错误[我项目中XAML页面的屏幕截图。点击图片以获得更好的视图]:

enter image description here

图片来自Microsoft Example

enter image description here

wpf windows-10 wpf-controls wpftoolkit
1个回答
0
投票

图像补丁应使用斜杠(/)而不是反斜杠()。图像应位于项目根目录下的图像折叠中。

enter image description here

<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>
© www.soinside.com 2019 - 2024. All rights reserved.