Here describió cómo puedo crear texto de varias columnas con desplazamiento horizontal en la aplicación de estilo Metro de Windows 8. ¿Hay manera de añadir "saltos de columna" para obtener cualquier título en la parte superior de la columna, no en el medio (teniendo en cuenta, que no sabemos cuántas columnas en cada sección):La columna se rompe en el texto mulicolumn en Windows 8 XAML
5
A
Respuesta
5
Puede crear ItemsControl y hacer que RichTextColumns como DataTemplate. Cada columna está en una lista que está vinculada a ItemsControl.
Aquí es muestra de XAML:
<ItemsControl x:Name="itemsControl">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<!-- Content is allowed to flow across as many columns as needed -->
<common:RichTextColumns x:Name="richTextColumns" Margin="25,20,25,20">
<RichTextBlock x:Name="richTextBlock" Width="200" Style="{StaticResource ItemRichTextStyle}" IsTextSelectionEnabled="False">
<Paragraph>
<Run FontSize="26.667" FontWeight="Light" Text="{Binding Title}"/>
<LineBreak/>
<LineBreak/>
</Paragraph>
<Paragraph>
<Run FontWeight="SemiLight" Text="{Binding Content}"/>
</Paragraph>
</RichTextBlock>
<!-- Additional columns are created from this template -->
<common:RichTextColumns.ColumnTemplate>
<DataTemplate>
<RichTextBlockOverflow Width="200" Margin="80,0,0,0">
<RichTextBlockOverflow.RenderTransform>
<TranslateTransform X="-1" Y="4"/>
</RichTextBlockOverflow.RenderTransform>
</RichTextBlockOverflow>
</DataTemplate>
</common:RichTextColumns.ColumnTemplate>
</common:RichTextColumns>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
Aquí es C# de código subyacente de la muestra:
protected override void OnNavigatedTo(NavigationEventArgs e)
{
var samples = new List<SampleColumnData>
{
new SampleColumnData{
Title = "Column1",
Content = "Just the good ol' boys, never meanin' no harm. Beats all you've ever saw, been in trouble with the law since the day they was born. Straight'nin' the curve, flat'nin' the hills. Someday the mountain might get 'em, but the law never will. Makin' their way, the only way they know how, that's just a little bit more than the law will allow. Just good ol' boys, wouldn't change if they could, fightin' the system like a true modern day Robin Hood. Knight Rider, a shadowy flight into the dangerous world of a man who does not exist. Michael Knight, a young loner on a crusade to champion the cause of the innocent, the helpless in a world of criminals who operate above the law. I never spend much time in school but I taught ladies plenty. It's true I hire my body out for pay, hey hey. I've gotten burned over Cheryl Tiegs, blown up for Raquel Welch. But when I end up in the hay it's only hay, hey hey. I might jump an open drawbridge, or Tarzan from a vine. 'Cause I'm the unknown stuntman that makes Eastwood look so fine. Barnaby The Bear's my name, never call me Jack or James, I will sing my way to fame, Barnaby the Bear's my name. Birds taught me to sing, when they took me to their king, first I had to fly, in the sky so high so high, so high so high so high, so - if you want to sing this way, think of what you'd like to say, add a tune and you will see, just how easy it can be. Treacle pudding, fish and chips, fizzy drinks and liquorice, flowers, rivers, sand and sea, snowflakes and the stars are free. La la la la la, la la la la la la la, la la la la la la la, la la la la la la la la la la la la la, so - Barnaby The Bear's my name, never call me Jack or James, I will sing my way to fame, Barnaby the Bear's my name. "
},
new SampleColumnData{
Title = "Column2",
Content = "Just the good ol' boys, never meanin' no harm. Beats all you've ever saw, been in trouble with the law since the day they was born. Straight'nin' the curve, flat'nin' the hills. Someday the mountain might get 'em, but the law never will. Makin' their way, the only way they know how, that's just a little bit more than the law will allow. Just good ol' boys, wouldn't change if they could, fightin' the system like a true modern day Robin Hood. Knight Rider, a shadowy flight into the dangerous world of a man who does not exist. Michael Knight, a young loner on a crusade to champion the cause of the innocent, the helpless in a world of criminals who operate above the law. I never spend much time in school but I taught ladies plenty. It's true I hire my body out for pay, hey hey. I've gotten burned over Cheryl Tiegs, blown up for Raquel Welch. But when I end up in the hay it's only hay, hey hey. I might jump an open drawbridge, or Tarzan from a vine. 'Cause I'm the unknown stuntman that makes Eastwood look so fine. Barnaby The Bear's my name, never call me Jack or James, I will sing my way to fame, Barnaby the Bear's my name. Birds taught me to sing, when they took me to their king, first I had to fly, in the sky so high so high, so high so high so high, so - if you want to sing this way, think of what you'd like to say, add a tune and you will see, just how easy it can be. Treacle pudding, fish and chips, fizzy drinks and liquorice, flowers, rivers, sand and sea, snowflakes and the stars are free. La la la la la, la la la la la la la, la la la la la la la, la la la la la la la la la la la la la, so - Barnaby The Bear's my name, never call me Jack or James, I will sing my way to fame, Barnaby the Bear's my name. "
},
new SampleColumnData{
Title = "Column3",
Content = "Just the good ol' boys, never meanin' no harm. Beats all you've ever saw, been in trouble with the law since the day they was born. Straight'nin' the curve, flat'nin' the hills. Someday the mountain might get 'em, but the law never will. Makin' their way, the only way they know how, that's just a little bit more than the law will allow. Just good ol' boys, wouldn't change if they could, fightin' the system like a true modern day Robin Hood. Knight Rider, a shadowy flight into the dangerous world of a man who does not exist. Michael Knight, a young loner on a crusade to champion the cause of the innocent, the helpless in a world of criminals who operate above the law. I never spend much time in school but I taught ladies plenty. It's true I hire my body out for pay, hey hey. I've gotten burned over Cheryl Tiegs, blown up for Raquel Welch. But when I end up in the hay it's only hay, hey hey. I might jump an open drawbridge, or Tarzan from a vine. 'Cause I'm the unknown stuntman that makes Eastwood look so fine. Barnaby The Bear's my name, never call me Jack or James, I will sing my way to fame, Barnaby the Bear's my name. Birds taught me to sing, when they took me to their king, first I had to fly, in the sky so high so high, so high so high so high, so - if you want to sing this way, think of what you'd like to say, add a tune and you will see, just how easy it can be. Treacle pudding, fish and chips, fizzy drinks and liquorice, flowers, rivers, sand and sea, snowflakes and the stars are free. La la la la la, la la la la la la la, la la la la la la la, la la la la la la la la la la la la la, so - Barnaby The Bear's my name, never call me Jack or James, I will sing my way to fame, Barnaby the Bear's my name. "
},
};
itemsControl.ItemsSource = samples;
}
Y aquí es una captura de pantalla:
Espero que esto ayude!
Cuestiones relacionadas
- 1. Texto de varias columnas de Windows 8 XAML
- 2. hipervínculo de Windows 8 xaml en línea
- 3. Multiprocesamiento en Windows se rompe
- 4. cómo animar la altura del control en Windows 8 XAML
- 5. ¿No hay DatePicker para xaml en Windows 8 Metro?
- 6. UTF-8 en Windows
- 7. rompe XmlReader en UTF-8 BOM
- 8. ¿Cómo se fabrican los mosaicos en vivo en Windows 8?
- 9. Los desencadenadores no son compatibles con Windows 8 XAML?
- 10. El nombre XXX no existe en el espacio de nombres YYY (XAML VS12 Windows 8)
- 11. desplegable Control de selección - Windows 8 Metro - XAML
- 12. C# windows phone -Alineación en xaml ListBox.ItemTemplate
- 13. ¿Cómo preseleccionar múltiples elementos listview/gridview en la aplicación C#/XAML windows 8?
- 14. Introducción de texto en Windows 8 en la aplicación C#/MonoGame
- 15. ¿Se ejecutará Windows Phone 8 SDK en Windows 7?
- 16. Andamios en Windows 8
- 17. PHP Convertir texto codificado para Windows-1256 en UTF-8
- 18. Windows 8 voz a texto y texto a voz API
- 19. ¿Cómo puedo desactivar el modo vertical en Windows 8?
- 20. Eclipse se rompe en processWorkerExit
- 21. Cargando texto codificado en utf-8 en la tabla MySQL
- 22. reproducir dos sonidos simultáneamente en Windows 8 Metro App (C#/XAML)
- 23. HttpWebRequest.GetRequestStream() se rompe por tiempo de espera en la conexión SSL en Windows 7/Vista
- 24. WP7 SDK en Windows 8
- 25. Crear una tabla (DataGrid) en Windows 8 aplicaciones de Metro (C#/XAML)
- 26. Echo caracteres UTF-8 en el lote de Windows
- 27. ¿Cuánto texto UTF-8 cabe en un campo MySQL "Texto"?
- 28. Cómo hacer un ScrollViewer de bucle/circular en Windows 8 Metro (C++/XAML)
- 29. ¿Puedes mezclar HTML y XAML en una aplicación Metro de Windows 8?
- 30. Agrupación de GridView en la aplicación Metro de Windows 8