c# - WPF DataGridTemplateColumn Width="*" Header too wide -
i trying assign width of each of datagridtemplatecolumn in datagrid using "*".
<datagrid name="mapping" horizontalalignment="stretch" verticalalignment="stretch" margin="1" itemssource="{binding information.signals}" selectionmode="single" autogeneratecolumns="false" virtualizingpanel.isvirtualizing="true" fontsize="10" rowdetailsvisibilitymode="visiblewhenselected" borderthickness="1" enablecolumnvirtualization="true" enablerowvirtualization="true" scrollviewer.verticalscrollbarvisibility="auto" scrollviewer.isdeferredscrollingenabled="true" scrollviewer.cancontentscroll ="true" virtualizingpanel.virtualizationmode="recycling" canuseraddrows="true" canuserresizerows="false" canuserdeleterows="true" selectionunit="fullrow" scrollviewer.horizontalscrollbarvisibility="auto" > <datagrid.columns> <datagridtemplatecolumn header="name" celltemplate="{staticresource nametemplate}" canusersort="true" canuserreorder="false" canuserresize="true" sortmemberpath="name" width="6*" > </datagridtemplatecolumn> <datagridtemplatecolumn header="type" celltemplate="{staticresource propertytemplate}" canusersort="true" canuserreorder="false" canuserresize="true" sortmemberpath="selectedproperty" width="4*"> </datagridtemplatecolumn>
and columntemplates similar one
<datatemplate x:key="nametemplate"> <grid horizontalalignment="stretch" verticalalignment="center"> <textblock text="{binding path=name}" minwidth="280" fontsize="11" fontfamily="calibri" horizontalalignment="stretch" verticalalignment="center"/> </grid> </datatemplate>
when window maximized scaling works fine. happens when not maximized, header 3 monitors wide, 3000 pixels.
if set width fixed value fine well. suggest me how tackle problem? use relative scaling using "*"
update: wpf project using mahapps controls, not sure if reason.
width , height when applied using "*" measured on count of "1". whenever divide screen has divided such 1 full part being divided.
using 4* , 6* incorrect. use 0.4* , 0.6* instead, sums one.
Comments
Post a Comment