1.7 互联网应用程序
在WPF中创建互联网应用程序和创建桌面程序是一样的。在桌面应用程序里,XAML的顶层元素为Window,在互联网应用程序里,XAML的顶层元素为Page。例如下面的网页:
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Page1"> <Grid> <Label Height="28" Margin="80,108,100,0" Name="label1" VerticalAlignment="Top">Hello WPF!</Label> </Grid> </Page>
该网页在IE 7中的显示结果如图1-5所示。
![](https://epubservercos.yuewen.com/6A757F/3590270704434301/epubprivate/OEBPS/Images/figure_0025_0001.jpg?sign=1739696259-xAqxgvDTq98Q51XHA4YcUtZazu2A4IuL-0-f9f7d3ffd732a8724a8c79296872b556)
图1-5 IE 7中显示的WPF网页