1
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:System="clr-namespace:System;assembly=mscorlib"
Title="MainWindow" Height="350" Width="525">
<Window.Resources>
<System:DateTime x:Key="d" >2012/7/8</System:DateTime>
</Window.Resources>
<StackPanel>
<ContentControl Content="{Binding}" DataContext="{StaticResource d}" />
<TextBlock Text="{Binding}" DataContext="{StaticResource d}"/>
</StackPanel>
</Window>
此代码给我下面的窗口。相同的绑定,不同的演示文稿?
奇怪的是,当应用到所述ContentControl中相同结合只显示日期部分,并且当应用于TextBlock中还示出了时间的一部分。
我只是好奇地知道原因,并问是否可以交换演示文稿,我的意思是TextBlock只显示日期部分和ContentControl显示两部分。
谢谢。
你的回答太快了!我几乎读完了自己的帖子。谢谢。 – Gqqnbig 2012-07-08 11:59:45