我试图将一个文本块放入网格元素,但它不显示在调试模式下。我做错了什么?也许这是我的C#代码直接操纵窗口的原因?XAML更改无效
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="400" Width="500" ResizeMode="NoResize">
<Window.Background>
<ImageBrush ImageSource="/WpfApplication2;component/Images/Grass0118_22_S.jpg"></ImageBrush>
</Window.Background>
<Grid>
<TextBlock Margin="10,10,0,0" Foreground="White" FontWeight="Bold">Życia:</TextBlock>
<TextBlock Margin="50,10,0,0" Foreground="White" Text="{Binding Text, ElementName=points}"></TextBlock>
</Grid>
</Window>
你能提供相关的代码吗?还有一些关于你的问题的具体细节? – 2011-06-05 15:41:20
上面附上的代码。 – deem 2011-06-05 15:52:18
如果你在后面的代码中操作窗口,为什么不添加它? – 2011-06-05 16:03:46