我在资源字典中有以下样式
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid>
<Rectangle Fill="#262626" Name="Normal"/>
<Rectangle Fill="#3f3f41" Name="Hover" Visibility="Hidden"/>
<Rectangle Fill="#007acc" Name="Pressed" Visibility="Hidden"/>
<Image Name="Icon"/>
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Hover" Property="Visibility" Value="Visible"/>
<Setter TargetName="Pressed" Property="Visibility" Value="Hidden"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="Pressed" Property="Visibility" Value="Visible"/>
<Setter TargetName="Hover" Property="Visibility" Value="Hidden"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
我需要从我的按钮(在我的 MainWindow.xaml 中)更改名称为“图标”的图像的“源”
<Button Style="{StaticResource ToolbarButton}">
<Setter TargetName="Icon" Property="Source" Value=".png"/>
</Button>
但它给了我错误“源无法识别或不可访问”
如何从按钮更改名称为“图标”的图像的“来源”属性?