wpfdatagrid - DataTemplate.Triggers Set Xaml Content inSetter -


                    <datagrid  margin="5" autogeneratecolumns="false" headersvisibility="all" itemssource="{binding path=testtubelist,mode=twoway}" rowheaderwidth="20" canuseraddrows="false" selectionunit="fullrow" >                     <datagrid.columns>                         <datagridcheckboxcolumn binding="{binding relativesource={relativesource ancestortype=datagridrow}, path=isselected, mode=oneway}"                                     editingelementstyle="{dynamicresource metrodatagridcheckbox}"                                     elementstyle="{dynamicresource metrodatagridcheckbox}"                                     header="选择行" />                         <datagridtextcolumn binding="{binding testno}" width="110" header="试管号" />                         <datagridtextcolumn binding="{binding examno}" width="110" header="sn" />                         <datagridtextcolumn binding="{binding status}" width="90" header="状态" />                         <datagridtextcolumn binding="{binding sampleid}" width="70" header="样本号" />                         <datagridtextcolumn binding="{binding platenumber}" width="70" header="版号" />                         <datagridtextcolumn binding="{binding customername}"  width="110" header="姓名" />                         <datagridtextcolumn binding="{binding age}"  width="60" header="年龄" />                         <!--<datagridtextcolumn binding="{binding sex}"  width="60" header="性别" />-->                         <datagridtemplatecolumn   width="60" header="性别">                             <datagridtemplatecolumn.celltemplate>                                 <datatemplate >                                     <!--<iconpacks:packiconmaterial x:name="seximage" horizontalalignment="center" />                                     <iconpacks:packiconfontawesome kind="female" />-->                                     <datatemplate.triggers>                                         <datatrigger  binding="{binding sex}" value="0">                                             <!--<setter targetname="seximage" property="kind" value="humanmale" />-->                                             <!--<iconpacks:packiconmaterial  horizontalalignment="center" />-->                                         </datatrigger>                                         <datatrigger  binding="{binding sex}" value="1">                                             <!--<setter targetname="seximage" property="kind" value="female" />-->                                             <!--<iconpacks:packiconfontawesome kind="female" horizontalalignment="center" />-->                                          </datatrigger>                                     </datatemplate.triggers>                                 </datatemplate>                             </datagridtemplatecolumn.celltemplate>                         </datagridtemplatecolumn>                      </datagrid.columns>                     <datagrid.style>                         <style basedon="{staticresource metrodatagrid}" targettype="{x:type datagrid}">                             <setter property="alternatingrowbackground" value="{dynamicresource graybrush10}" />                         </style>                     </datagrid.style>                 </datagrid> 

i want set datagridtemplatecolumn sex.when sex equal 0,set <iconpacks:packiconmaterial horizontalalignment="center" />;when sex equal 1,set <iconpacks:packiconfontawesome kind="female" horizontalalignment="center" /> ,i try set setter property datatemplate,but didn't work.maybe made grammar mistake。my goal replace them different templates


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -