我是新来的wpf,xaml,是一个c初学者!我一直在做这个工作,我不知道为什么下面的xaml只显示一个简单的窗口。没有按钮,没有标题,没有内容。我很感激你的指导。如果问我为什么要使用mediachecker,我会按照stack overflow下面文章中的一个例子来做:
How do i navigate from one Xaml file to another?
提前谢谢。
<Window x:Class="MediaCheckerWPF.AboutBox"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="About Media Checker" Height="300" Width="400" ResizeMode="NoResize"
ShowInTaskbar="False">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="28" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="200" />
</Grid.ColumnDefinitions>
<Label Grid.Row="0" Grid.Column="0" Content="Name:"/>
<Label Grid.Row="1" Grid.Column="0" Content="E-Mail:"/>
<Label Grid.Row="2" Grid.Column="0" Content="Comment:"/>
<Button Grid.Column="1" Grid.Row="0" HorizontalAlignment="Right"
MinWidth="80" Margin="3" Content="START" />
<Button Grid.Column="1" Grid.Row="3" HorizontalAlignment="Right"
MinWidth="80" Margin="3" Content="STOP" />
</Grid>
</Window>
最佳答案
你的xaml渲染得很好。如果你得到的是一个空白窗口,那么我怀疑这与其他事情有关,比如启动一个不同的窗口。
再次检查Window
标签的StartupUri属性中是否启动了正确的<Application>
。
<Application x:Class="MediaCheckerWPF.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="AboutBox.xaml">
<Application.Resources>
</Application.Resources>
</Application>
关于wpf - 为什么我的xaml只显示一个普通的窗口而没有显示任何内容,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/12148097/