c# - How To Make Text Wrap in a .NET 4.5 DataGrid Column -


i new this. application has two-column datagrid control. both contain text strings. first column text fits in column text in second column should wrap when hits column width or control width. whenever wraps, content of column 1 centered vertically.

how can second column wrap , first one's content become centered vertically when wrapping occurs?

at present auto-generating columns. experimented not auto-generating columns , using following:

        <datagrid x:name="loggrid" margin="10,10,10,0" verticalalignment="top" loaded="loggrid_loaded" background="#ffb8b5a4" minwidth="380" horizontalalignment="center" canuserreordercolumns="false" canuserresizecolumns="false" canuserresizerows="false" width="380" autogeneratecolumns="false">         <datagrid.columns>             <datagridtextcolumn x:name="timecolumn" header="time" isreadonly="true" sortdirection="ascending" width="55"/>             <datagridtextcolumn x:name="logentrycolumn" header="log entry" canusersort="false" width="325">                 <datagridtextcolumn.elementstyle>                     <style targettype="{x:type textblock}">                         <setter property="textblock.textwrapping" value="wrap"/>                     </style>                 </datagridtextcolumn.elementstyle>             </datagridtextcolumn>         </datagrid.columns>     </datagrid> 

the result text wrapping did not work , data not transferred control's columns (i not using data-binding don't understand yet). couldn't figure out how make data appear in manually defined columns. force me use data binding?

so abandoned approach , awaiting help.

thanks.

right click on "edit columns" on datagridview, choose column, expand "defaultcellstyle" , set "wrapmode" = true


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -