【发布时间】:2014-01-03 02:23:50
【问题描述】:
我目前正在处理一个新项目,我需要在我的 WPF 项目中更改图像的来源,但是当我进入代码隐藏时,它在上下文中找不到名称。这是我的代码:
<Button x:Name="mediaControlButton" Width="20" Height="20" Margin="161,54,219,26">
<Button.Template>
<ControlTemplate>
<Border HorizontalAlignment="Center" VerticalAlignment="Center" >
// This is the image I need to change the source wich the Code Behing can't find.
<Image x:Name="iconPlaying" Source="Resources/play.png"
Width="20"
Height="20"/>
</Border>
</ControlTemplate>
</Button.Template>
</Button>
【问题讨论】:
-
我会参考这个类似的问题来说明这不是一个好主意,stackoverflow.com/questions/8313360/…