wpf - How to center a Table or a List horizontally in a FlowDocument? -
wpf - How to center a Table or a List horizontally in a FlowDocument? -
below sample code default wpf application's mainwindow.xaml. first , lastly 'block's in document paragraphs , middle 1 table. table appear @ left border of column , area right of table blank. center table in space.
i have tried putting table within 'section', 'paragraph' etc, didn't have luck. floater within paragraph works, table flow next paragraph. can using 2 empty columns on left , right way calculate widths dynamically, looks overkill.
thanks jeevaka
<window x:class="flowdocument.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="mainwindow" height="700" width="700"> <flowdocumentpageviewer> <flowdocument> <paragraph fontsize="24">moons of saturn</paragraph> <paragraph>the moons of saturn numerous , diverse, ranging tiny moonlets less 1 kilometre across, enormous titan, larger planet mercury. saturn has 62 moons confirmed orbits, fifty-three of have names, , 13 of have diameters larger 50 kilometres. saturn has 7 moons big plenty become spherical, , dense rings complex orbital motions of own. particularly notable among saturn's moons titan, sec largest moon in solar system, nitrogen-rich earth-like atmosphere , landscape including hydrocarbon lakes , dry river networks, , enceladus, emits jets of gas , dust , may harbor liquid water under south pole region.</paragraph> <table textalignment="right" borderbrush="black" borderthickness="1" background="black"> <table.columns> <tablecolumn width="100" ></tablecolumn> <tablecolumn width="100"></tablecolumn> </table.columns> <tablerowgroup> <tablerow> <tablecell background="white" padding="5"> <paragraph>name</paragraph> </tablecell> <tablecell background="white" padding="5"> <paragraph>diameter</paragraph> </tablecell> </tablerow> <tablerow> <tablecell background="white" padding="5"> <paragraph>mimas</paragraph> </tablecell> <tablecell background="white" padding="5"> <paragraph>396</paragraph> </tablecell> </tablerow> <tablerow> <tablecell background="white" padding="5"> <paragraph>enceladus</paragraph> </tablecell> <tablecell background="white" padding="5"> <paragraph>504</paragraph> </tablecell> </tablerow> <tablerow> <tablecell background="white" padding="5"> <paragraph>tethys</paragraph> </tablecell> <tablecell background="white" padding="5"> <paragraph>1062</paragraph> </tablecell> </tablerow> </tablerowgroup> </table> <paragraph>twenty-four of saturn's moons regular satellites; have prograde orbits not inclined saturn's equatorial plane. include 7 major satellites, 4 little moons exist in trojan orbit larger moons, 2 mutually co-orbital moons , 2 moons deed shepherds of saturn's f ring. 2 other known regular satellites orbit within gaps in saturn's rings. relatively big hyperion locked in resonance titan. remaining regular moons orbit near outer border of ring, within g ring , between major moons mimas , enceladus. regular satellites traditionally named after titans , titanesses or other figures associated mythological saturn.</paragraph> </flowdocument> </flowdocumentpageviewer> </window>
there wpf element attribute called horizontalalignment
want surround element of involvement within container grid or border , set attribute center
wpf rest of magic.
wpf xaml flowdocument
Comments
Post a Comment