WPF에서 이런식으로 스토리를 보여주고 싶었다.(이건 완성된버전 ㅋㅋ)
이건 그냥 TextBlock으로 되는것이 아니다.
그래서 FlowDocument를 사용하였다..
일단 xaml에서 이렇게 코딩을 했다.
<FlowDocumentScrollViewer Grid.Row="1" Grid.ColumnSpan="2" VerticalScrollBarVisibility="Hidden" >
<FlowDocument Background="Transparent">
<Paragraph FontFamily="Bell MT" FontSize="24" x:Name="DescriptionParagraph">
<Floater Width="500" HorizontalAlignment="Left">
<BlockUIContainer>
<Rectangle Height="250" />
</BlockUIContainer>
</Floater>
One Day, most of the town’s roads are ruined by the heavy rain. On that day, school bus-Schoobi happens to be late because of constructions on the road. Worrying that children may be waiting at the bus stop, Schoobi drives through the traffic with full speed, even though other cars are starring at him in a disapproving manner. Schoobi gets to a costal road, however, the road condition there is also messy. Dilly-dallying and regreting to go back. Schoobi ends up ramming into the guardail. Schoobi is now in the danger of falling down the cliff. Can Robocar Poli and his team save Schoobi?
</Paragraph>
</FlowDocument>
</FlowDocumentScrollViewer>
private void SetDescriptionPlaceholder(string param)
{
DescriptionParagraph.Inlines.Remove(DescriptionParagraph.Inlines.Where(c => c is System.Windows.Documents.Run == true).Select(c => c).FirstOrDefault());
DescriptionParagraph.Inlines.Add(param);
}
이렇게 inline을 삭제하고 다시 추가하는 형식으로 바꾸었다.
이렇게 하면 끝~
'Surface' 카테고리의 다른 글
[surface] generic.xaml의 x:Name을 잡아내서 Control안에서 조정하기 (0) | 2012.04.25 |
---|---|
[surface] Control만들때 OnApplyTemplate()이 호출되지 않을때 (0) | 2012.04.25 |
[surface] 로봇캅 폴리 포스팅 퍼오기 ㅋ (0) | 2011.09.14 |
[surface] surface 런칭쇼에 내가 만든 프로그램 공개 (0) | 2011.05.27 |
[surface] WPF에서 VisualState 쓰기 (0) | 2011.05.19 |