【发布时间】:2012-08-27 19:11:58
【问题描述】:
我是 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 渲染得很好。如果你得到一个空白窗口,那么我怀疑它与其他事情有关,例如没有启动正确的窗口。
-
雷切尔;感谢您的回答帮助,问题是:没有启动正确的窗口。但是,我找不到投票支持您的方法。我想你必须选择答案,然后我才能给出我的反馈。再次感谢。
-
很高兴帮助你:) 我在下面的答案中为你扩展了我的评论
标签: wpf windows visual-studio-2010 xaml