c# - Apply behaviour to WPF DataGrid Row -


i'd attach behaviour (component one) data grid row.

the problem is: can't datacontext of actual row. in style data context data grid.. how can row's data context?

<c1:c1datagrid.rowstyle>     <style targettype="c1:datagridrowpresenter">             <setter property="ui:datagridrowhierarchybehavior.isexpanded" value="{binding isexpanded, relativesource=}" />     </style> </c1:c1datagrid.rowstyle> 

i know how 'get up' visual tree using relativesource -
though how 'getting down' work don't have clue..

any hints appreciated!

to dataitem of row, need use relativesource in binding in following way :

<c1:c1datagrid.rowstyle>    <style targettype="{x:type c1:datagridrowpresenter}">       <setter property="background" value="{binding relativesource={relativesource self}, path=row.dataitem.background}"></setter>    </style> </c1:c1datagrid.rowstyle> 

i've used background property example.


Comments