大家好,我有一个小应用程序的开始部分,它可以检查.resx文件中嵌套括号的一致性(以避免非匹配“... {0}”字符串的运行时错误)。下面是MainWindow.xaml的XAML代码,我的问题与要显示在按钮上的图像有关。
<Window x:Class="ResxChecker.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="174.383" Width="495.869">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="350*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="30*"/>
</Grid.RowDefinitions>
<Label Content="Select .resx file:" HorizontalAlignment="Left" Margin="10,0,0,0" VerticalAlignment="Top" Height="24" Width="Auto" Grid.ColumnSpan="1"/>
<TextBox Grid.ColumnSpan="2" HorizontalAlignment="Stretch" Margin="10,0,0,0" Grid.Row="1" TextWrapping="Wrap" Text="" VerticalAlignment="Top"/>
<Button Grid.Column="2" HorizontalAlignment="Right" Margin="5,0,10,0" Grid.Row="1">
<Image VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="16 " Width="16" Source="pack://siteoforigin:,,,/Resources/UserCost2013Open16.png"/>
</Button>
</Grid>
</Window>
图片的“生成操作 = Resource”,“复制到输出目录 = 不复制” - 图片在设计器中显示但在运行时不显示。我已经看过以下问题并阅读了相关答案,但都没有解决问题:
如何使按钮图像在运行时显示?