나는 해결하려고 애쓰는 흥미로운 문제가 있습니다. 기본적으로 나는 ItemsPanel
으로 여러 바인딩 된 문자열로 만든 단락을 시뮬레이트하기 위해 WrapPanel
을 사용하는 항목 컨트롤이 있습니다. 그러나 내가 새 단락을 시작할 때와 같이 휴식을 강요 할 필요가있는 시간이 있지만 TextBlock
DateTemplate
에 중단을 넣는 것은 실제로 부모 랩 패널에 중단을 두지 않습니다. 여기랩 패 널 템플릿을 사용하여 항목 컨트롤에서 휴식을 취하십시오.
<ItemsControl ItemsSource="{Binding Fragments}" >
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBlock
TextWrapping="Wrap"
Text="{Binding}"/> <!--If this text has a break it won't
propagate that break to the wrap panel,
but instead just in this text block which
causes the formatting to look wrong-->
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
내가 무슨 말을하고 무엇을 보여줄 것이다 조각에 대한 간단한 정의는 다음과 같습니다 : 여기에 코드입니다
Fragments = new ObservableCollection<string>();
Fragments.Add("This is");
Fragments.Add("the first line, ");
Fragments.Add("it is very long and will drift to the ");
Fragments.Add("second line naturally since it is controlled by a wrap panel");
Fragments.Add("\n\r This I want to force to the line below where the line above ends");
Fragments.Add("rapid \n\r new \n\r lines");
나는 단락으로 흐름이 싶습니다
그 단지 연결을 계속 유지하면서 수동 브레이크가 실행되면이를 존중하십시오. 이렇게 :
This is the first line, it is very long and will drift to the second line naturally since it is controlled by a wrap panel. This I want to force to the line below where the line above ends. rapid new lines
어떤 이유로 당신이 문자열을 연결 한 후 간단한 텍스트 상자에 바인딩되지 않은이 있습니까? – Kenneth
문자열을 연결하지 않고 간단한 텍스트 상자에 바인딩하는 이유가 있습니까? – Kenneth
"Break"는 "NewLine"을 의미합니까? –