c# - Textblocks overlapping each other in XAML -


this trying obtain:

name date 

this xaml have. in result, both texts name & date overlapping each other.

<datatemplate>     <grid x:name="showgrid">         <grid.rowdefinitions>             <rowdefinition height="auto"/>             <rowdefinition height="auto"/>         </grid.rowdefinitions>         <stackpanel>             <grid height="{binding widthma}" width="{binding widthma}">                 <grid margin="3.5" background="white">                                                                                     <grid verticalalignment="bottom" background="black" height="30">                         <textblock text="{binding strname}" style="{staticresource albumtitletext}" grid.row="0" />                         <textblock text="{binding datecreated}" style="{staticresource artisttitletext}" grid.row="1" />                     </grid>                 </grid>             </grid>         </stackpanel>                                                     </grid> </datatemplate> 

and styles albumtitletext , artisttitletext here

<style x:key="albumtitletext" targettype="textblock">     <setter property="foreground" value="white" />     <setter property="horizontalalignment" value="left" />     <setter property="fontsize" value="18" />     <setter property="fontfamily" value="fonts/gotham-bold.ttf#gotham bold" />     <setter property="texttrimming" value="characterellipsis" />     <setter property="fontweight" value="bold" />                 <setter property="margin" value="10,-2,10,7"></setter> </style>  <style x:key="artisttitletext" targettype="textblock">     <setter property="foreground" value="white" />     <setter property="horizontalalignment" value="left" />     <setter property="fontsize" value="16" />     <setter property="fontfamily" value="fonts/gotham-bold.ttf#gotham bold" />     <setter property="texttrimming" value="characterellipsis" />     <setter property="fontweight" value="normal" />     <setter property="margin" value="10,7,10,0"></setter> </style> 

i think row definitions in wrong place. try ...

<datatemplate>      <grid x:name="showgrid">          <stackpanel>             <grid height="{binding widthma}" width="{binding widthma}">                 <grid margin="3.5" background="white">                                                                                     <grid verticalalignment="bottom" background="black" height="30">                          <grid.rowdefinitions>                              <rowdefinition height="auto"/>                              <rowdefinition height="auto"/>                           </grid.rowdefinitions>                         <textblock text="{binding strname}" style="{staticresource albumtitletext}" grid.row="0" />                         <textblock text="{binding datecreated}" style="{staticresource artisttitletext}" grid.row="1" />                     </grid>                 </grid>             </grid>         </stackpanel>                                                     </grid> </datatemplate> 

Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -