i searched on internet , cannot find simple solution stretch table columns content width, , how centralize table in middle of screen. aligned left. tried <tablecolumn width="auto">
. did not trick. thing worked <tablecolumn width="200">
. how can cause columns stretch content width, , how can put table in middle of screen? or, should resort grid option?
here xaml:
<src:basesurveyelement x:class="question14" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:src="clr-namespace:daqexperiment" title="question14" fontstyle="normal" fontsize="20" windowstate="maximized" > <grid height="600" width="1100"> <grid.rowdefinitions> <rowdefinition height="2*"/> <rowdefinition height="2*"/> </grid.rowdefinitions> <!-- <flowdocumentreader grid.row="0" name="flowdocreader" margin="2 2 2 2" viewingmode="scroll"/> --> <textblock name="txtblock" grid.row="0" margin="20" textwrapping="wrap" /> <!--<scrollviewer height="500" width="1100" grid.row="1" verticalscrollbarvisibility="visible" cancontentscroll="true">--> <flowdocumentreader grid.row="1" uselayoutrounding="true" snapstodevicepixels="true" width="1200"> <flowdocumentreader.resources> <style targettype="tablecell"> <setter property="textalignment" value="center"/> </style> </flowdocumentreader.resources> <flowdocument > <table cellspacing="0" textalignment="justify" > <table.columns > <tablecolumn /> <tablecolumn /> <tablecolumn /> <tablecolumn /> <tablecolumn /> <tablecolumn /> </table.columns> <tablerowgroup paragraph.textalignment="center" > <tablerow> <tablecell borderbrush="black" borderthickness="1"> <paragraph fontweight="bold"></paragraph> </tablecell> <tablecell borderbrush="black" columnspan="2" borderthickness="0,1,1,1"> <paragraph fontweight="bold">option a</paragraph> </tablecell> <tablecell borderbrush="black" columnspan="2" borderthickness="0,1,1,1"> <paragraph fontweight="bold">option b</paragraph> </tablecell> <tablecell borderbrush="black" borderthickness="0,1,1,1"> </tablecell> </tablerow> <tablerow> <tablecell borderbrush="black" borderthickness="1,0,1,1"> <paragraph fontweight="bold">subscription</paragraph> </tablecell> <tablecell borderbrush="black" borderthickness="0,0,1,1"> <paragraph>monthly</paragraph> </tablecell> <tablecell borderbrush="black" borderthickness="0,0,1,1"> <paragraph>yearly</paragraph> </tablecell> <tablecell borderbrush="black" borderthickness="0,0,1,1"> <paragraph>monthly</paragraph> </tablecell> <tablecell borderbrush="black" borderthickness="0,0,1,1"> <paragraph>monthly</paragraph> </tablecell> <tablecell borderbrush="black" borderthickness="0,0,1,1"> <paragraph> <stackpanel orientation="vertical" margin="10,5,10,10" name="spl1rdbtn"> <radiobutton groupname="rbtngrp1" content="choice a" margin="0,0,20,0" name="rbtn1a" /> <radiobutton groupname="rbtngrp1" content="choice b" margin="0,0,20,0" name="rbtn1b" /> </stackpanel> </paragraph> </tablecell> </tablerow> <tablerow> <tablecell borderbrush="black" borderthickness="1,0,1,1" textalignment="center"> <paragraph fontweight="bold">price</paragraph> </tablecell> <tablecell borderbrush="black" borderthickness="0,0,1,1"> <paragraph>$120.00</paragraph> </tablecell> <tablecell borderbrush="black" borderthickness="0,0,1,1"> <paragraph>$1000.00</paragraph> </tablecell> <tablecell borderbrush="black" borderthickness="0,0,1,1"> <paragraph>$130.00</paragraph> </tablecell> </tablerow> </tablerowgroup> </table> </flowdocument> </flowdocumentreader> <!--</scrollviewer>--> </grid> <window.background> <lineargradientbrush endpoint="0.5,0" startpoint="0.5,1"> <gradientstop color="gray" offset="0" /> <gradientstop color="white" offset="1" /> </lineargradientbrush> </window.background>
and here result:
to make table center aligned
<table horizontalalignment="centre" verticalalignment="center">
& make column width try using * instead of auto or put number , * "2*"
Comments
Post a Comment