i created custom tool-tip style defined in .xaml files loaded on application startup or when user changes application theme. because tool-tip used multiple controls slight differences each of them, decided create separate resource dictionary file style definitions common controls use tool-tip. on other hand, put control-specific styles separate resource dictionary files. files use merged dictionary reference file common styles mentioned.
the base file contains multiple style definitions, , @ least 1 of them has style trigger defined. trigger shows drop shadow when dependency property hasdropshadow of tool-tip set true. style extended in control-specific files (using basedon attribute).
for reason, when run app on windows server 2012, drop shadow not visible. on other hand, when run app on windows 7, drop shadow visible expected. wrong way declared binding or windows affect tool-tip's hasdropshadow property in way?
please note when set effect property directly, without using triggers, drop shadow visible, on windows 2012.
do have idea cause behaviour?
here base stylebase_user_tooltip.xaml file (i removed unrelated content it):
<resourcedictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:client="clr-namespace:client;assembly=client"> <style x:key="tooltipborderbase" targettype="border"> <setter property="padding" value="10,10,10,10" /> <setter property="borderthickness" value="0" /> <setter property="background"> <setter.value> <imagebrush imagesource="images\user_tooltip\background_bar.png" /> </setter.value> </setter> <!--drop shadow visibility--> <style.triggers> <datatrigger binding="{binding relativesource={relativesource ancestortype=client:user_tooltip}, path=hasdropshadow}" value="true"> <setter property="effect"> <setter.value> <dropshadoweffect blurradius="5" opacity="0.4"/> </setter.value> </setter> </datatrigger> </style.triggers> </style> <style x:key="tooltipcontent" targettype="client:user_tooltip"> <setter property="tooltipservice.placement" value="left" /> <setter property="staysopen" value="true" /> <setter property="template"> <setter.value> <controltemplate targettype="{x:type client:user_tooltip}"> <border style="{dynamicresource tooltipborder}"> <stackpanel style="{staticresource tooltipcontentcontainer}"> ... </stackpanel> </border> </controltemplate> </setter.value> </setter> </style> </resourcedictionary> and here 1 of control-specific files:
<resourcedictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:client="clr-namespace:client;assembly=client"> <resourcedictionary.mergeddictionaries> <resourcedictionary source="stylebase_user_tooltip.xaml" /> <resourcedictionary> <style x:key="tooltipborder" targettype="border" basedon="{staticresource tooltipborderbase}"> <setter property="margin" value="2,0,8,8" /> </style> </resourcedictionary> </resourcedictionary.mergeddictionaries> </resourcedictionary> thank you!
i think i've found answer. in example bound drop shadow's trigger inbuilt hasdropshadow property of tool-tip. assigned value of true @ runtime, windows server 2012 did not show drop shadow, opposed windows 7.
however, when declared separate dependency property indicate whether drop shadow should visible, , bound above mentioned trigger instead, windows server 2012 displayed drop shadow properly.
so, right dependency properties may have values controlled os?
btw, forgot mention client:user_tooltip descendant of system.windows.controls.tooltip.
Comments
Post a Comment