我尝试了以下代码,但它不起作用。有什么建议?
<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>
答案 0 :(得分:0)
这应该有效:
<Window ...
Icon="{Binding Path=MainWindow.Icon, Source={x:Static Application.Current}}">
<Grid>
</Grid>
</Window>