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