我尝试了下面的代码,但它不起作用。有什么建议?
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Window1" x:Name="Window1" Title="Window1"
Height="300" Width="300"
Icon="{Binding ElementName=Application.Current.MainWindow, Path=Icon}" >
<Grid>
</Grid>
这应该工作:
<Window ...
Icon="{Binding Path=MainWindow.Icon, Source={x:Static Application.Current}}">
<Grid>
</Grid>
</Window>