8,734
社区成员
发帖
与我相关
我的任务
分享
XAML文档基本框架
<Window x:Class="WpfDemo.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
</Grid>
</Window>
这个文档只包含两个元素——顶级的Window元素,以及一个Grid元素,Window元素代表整个窗口,在Grid元素中可以放置所有控件。尽管可以使用任何顶级元素,但是WPF应用程序只使用以下几个元素作为顶级元素:
①Window元素
②Page元素(该元素和Window元素类似,但是它用于可导航的应用程序)
③Application元素(该元素定义应用程序资源和启动设置)
<SplashWindow FrameworkElement.Width="458" FrameworkElement.Height="598" Window.ResizeMode="NoResize" Window.WindowStyle="None" Window.WindowStartupLocation="CenterScreen" Window.ShowInTaskbar="False" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<Grid>
<Image Image.Source="/Images/Splash.png" Image.Stretch="UniformToFill" />
<TextBlock TextBlock.Name="productNameTextBlock" FrameworkElement.Margin="30,27,30,100" TextBlock.Foreground="#FFFFFFFF" TextBlock.FontSize="32" FrameworkElement.HorizontalAlignment="Left" FrameworkElement.VerticalAlignment="Top" TextBlock.TextWrapping="Wrap" TextBlock.Text="{x:Static res:Resources.productNameText}" />
<TextBlock TextBlock.Name="versionTextBlock" FrameworkElement.Margin="30,92,30,100" TextBlock.Foreground="#FF999999" TextBlock.FontSize="27" FrameworkElement.HorizontalAlignment="Left" FrameworkElement.VerticalAlignment="Top" TextBlock.TextWrapping="Wrap" TextBlock.Text="{x:Static res:Resources.versionText}" />
<TextBlock TextBlock.Name="copyrightTextBlock" FrameworkElement.Margin="30,0,30,72" TextBlock.Foreground="#FF999999" TextBlock.FontSize="12" FrameworkElement.HorizontalAlignment="Left" FrameworkElement.VerticalAlignment="Bottom" TextBlock.TextWrapping="Wrap" TextBlock.Text="{x:Static res:Resources.copyrightText}" />
<TextBlock TextBlock.Name="registrationTextBlock" FrameworkElement.Margin="32,0,30,32" TextBlock.Foreground="#FFFFFFFF" TextBlock.FontSize="14" FrameworkElement.HorizontalAlignment="Left" FrameworkElement.VerticalAlignment="Bottom" TextBlock.TextWrapping="Wrap" TextBlock.Text="{x:Static res:Resources.registrationText}" />
</Grid>
</SplashWindow>