wpf - DataGridColumnHeader Style -
<style targettype="datagridcolumnheader"> <setter property="template"> <setter.value> <controltemplate targettype="{x:type datagridcolumnheader}"> <border x:name="buttonborderouter" borderbrush="#dbdbdb" borderthickness="1" background="#00ececec" padding="2"> <contentpresenter horizontalalignment="{templatebinding horizontalcontentalignment}" verticalalignment="{templatebinding verticalcontentalignment}" snapstodevicepixels="{templatebinding snapstodevicepixels}" /> <border.triggers> <eventtrigger routedevent="mouseenter"> <beginstoryboard> <storyboard> ... </storyboard> </beginstoryboard> </eventtrigger> <eventtrigger routedevent="mouseleave"> <beginstoryboard> <storyboard> ... </storyboard> </beginstoryboard> </eventtrigger> </border.triggers> </border> </controltemplate> </setter.value> </setter> </style>
the above code shows style
datagridcolumnheader
. it's working fine mouseenter
, mouseleave
effect there small things don't like. there have right below here.
the problem here each cell
in header
has rounded border. want between 2 cells
in header
1 single straight line. also, when click on 1 of cells
in header
, there no arrow showing sorting , no highlight column that's sorted.
does has template edit myself achieve want? or parts have edit?
by default datagridcolumnheaderspresenter draws additional column header of full width in background of datagrid header. leaving out dummy header want. add style styles:
<style targettype="{x:type datagridcolumnheaderspresenter}"> <setter property="template"> <setter.value> <controltemplate targettype="{x:type datagridcolumnheaderspresenter}"> <grid> <itemspresenter /> </grid> </controltemplate> </setter.value> </setter> </style>
Comments
Post a Comment