我是Visual Studio和WPF Iron Python开发的新手。我正在尝试加载带有图像的窗口。该图像出现在xmal预览中。但是,当我在Visual Studio中启动程序时,只会出现一个没有图像的白色窗口。
铁Python代码
import wpf
from System.Windows import Application, Window
class MyWindow(Window):
def __init__(self):
wpf.LoadComponent(self, 'TestApp.xaml')
if __name__ == '__main__':
Application().Run(MyWindow())
xmal码
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="SOC_Workups" Height="446.615" Width="767.993">
<Grid>
<Image HorizontalAlignment="Left" Height="78"
VerticalAlignment="Top" Width="229" Margin="261,160,0,0"
Source="images/logo.png"/>
</Grid>
</Window>