Visual Studio 2017:编译代码后空白窗口

时间:2018-12-12 15:26:14

标签: xaml visual-studio-2017

最近我开始在VS内部学习编码;有时由于我不知道的原因,该可执行文件并没有像在VS2017中预览那样描绘XAML代码。相反,它所做的只是描绘了白色的窗户。

作为对照示例,我编写了一些准系统XAML代码,该代码应仅显示彩色网格,几个按钮和一个文本块:

    <Page
x:Class="App1.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App1"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid HorizontalAlignment="Center" Height="1000" Margin="0,0,0,0" VerticalAlignment="Center" Width="1500" Background="#FFEE6363">
    <Grid.RowDefinitions>
        <RowDefinition/>
        <RowDefinition/>
        <RowDefinition/>
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
        <ColumnDefinition/>
        <ColumnDefinition/>
    </Grid.ColumnDefinitions>
    <Button Content="Show a message" HorizontalAlignment="Left" Margin="160,59,0,0" VerticalAlignment="Top" Height="176" Width="355" FontSize="20" />
    <Button Content="Button number two" Grid.Column="1" HorizontalAlignment="Center" Margin="0,103,0,0" VerticalAlignment="Top" Height="103" Width="275" FontSize="28" />
    <Button Content="Button number three" HorizontalAlignment="Left" Margin="211,113,0,0" Grid.Row="1" VerticalAlignment="Top" Height="115" Width="434" FontSize="28"/>
    <Button Content="Button number three" Grid.Column="1" HorizontalAlignment="Left" Margin="190,113,0,0" Grid.Row="1" VerticalAlignment="Top" Height="98" Width="350" FontSize="28"/>
    <TextBlock x:Name="myLabel" HorizontalAlignment="Left" Margin="685,133,0,0" Grid.Row="2" Text="" TextWrapping="Wrap" VerticalAlignment="Top" Grid.ColumnSpan="2" />
</Grid>

但是,在编译此代码时,我却没有响应,出现白屏。

我不确定错误是代码还是VS2017造成的,因为我仍然是新手,对此事我将不胜感激。

0 个答案:

没有答案