wpf - Explicit DataGrid CellStyle Setter is overridden by an implicit cellstyle in the same context? -
wpf - Explicit DataGrid CellStyle Setter is overridden by an implicit cellstyle in the same context? -
i have weird issue datagrid
in wpftoolkit (.net 3.5) , built in version in .net 4.0:
when creating keyed datagrid
-style explicit setter cellstyle
keyed style works suspected. when creating keyless style datagridcell
override explicit cellstyle
-setter in datagrid
-style. seems wrong. design or bug?
<window.resources> <style targettype="datagridcell"> <setter property="background" value="blue" /> </style> <style x:key="cellstyle1" targettype="datagridcell"> <setter property="background" value="green" /> </style> <style targettype="datagrid"> <setter property="background" value="yellow" /> <setter property="cellstyle" value="{staticresource cellstyle1}" /> </style> <xmldataprovider x:key="xmldata" xpath="data/*"> <x:xdata> <data xmlns=""> <item1 /> <item2 /> <item3 /> </data> </x:xdata> </xmldataprovider> </window.resources> <grid> <datagrid itemssource="{binding source={staticresource xmldata}}" /> </grid>
this works :
<datagrid itemssource="{binding source={staticresource xmldata}}" cellstyle="{staticresource cellstyle1}" />
it seems un-keyed style of datagrid
weaker un-keyed style of datagridcell
. it's quite strange, bit complex question : unkeyed mother vs unkeyed child, should wins ?
wpf datagrid override styles
Comments
Post a Comment