Tooltip Not Showing Up When No Validation Error WPF -


i searched , did not see solution.

i can validation show tooltip if not set tooltip in combo box tooltip property. see validation error tooltip when 1 present otherwise show tooltip combobox property. validation tooltip shows fine when remove text tooltip property (i.e. property panel combo box).

the xaml in application.resources (app.xaml)for tooltip show validation error

    <style x:key="standardcomboboxstyle" targettype="{x:type combobox}">     <style.triggers>         <trigger property="validation.haserror" value="true">             <setter property="tooltip" value="{binding relativesource={x:static relativesource.self}, path=(validation.errors)[0].errorcontent}"/>         </trigger>     </style.triggers> </style> 

i use validation template combobox follows. in usercontrol.resources section within user control cs file.

<controltemplate x:key="comboboxvalidationtemplate">     <dockpanel name="mydockpanel">         <border borderbrush="red" borderthickness="3">             <adornedelementplaceholder name="myadorner" />         </border>         <textblock text="*" fontweight="bold" fontsize="18" foreground="red" dockpanel.dock="left" />     </dockpanel> </controltemplate> 

the control defined follows. note there other references not defined here (but not pertinent - feel free let me know if questions).

        <combobox x:name="exposuretime" selectedvaluepath="content"         text="{binding exposuretime, mode=twoway, updatesourcetrigger=propertychanged, validatesondataerrors=true, validatesonexceptions=true}" iseditable="true" validation.errortemplate="{staticresource comboboxvalidationtemplate}"         horizontalcontentalignment="right" fontsize="18" margin="136,47,462,0" height="27" verticalalignment="top" gotfocus="combobox_gotfocus_1" lostfocus="combobox_lostfocus_1" previewtextinput="exposuretime_previewtextinput" opacity="{binding backgroundopacity, mode=twoway, updatesourcetrigger=propertychanged}" fontweight="thin" style="{dynamicresource standardcomboboxstyle}" selectedvalue="{binding mode=oneway, validatesondataerrors=true, validatesonexceptions=true}" istextsearchenabled="false" tooltip="my tooltip test.">         <comboboxitem content="0.05"/>         <comboboxitem content="0.1"/>         <comboboxitem content="0.2" />         <comboboxitem content="1" />         <comboboxitem content="2" />         <comboboxitem content="5" />         <comboboxitem content="10" />         <comboboxitem content="20" />         <comboboxitem content="60" />         <combobox.isenabled >             <multibinding converter="{staticresource multibooleanconverter}">                 <binding path="notperformingexposure" updatesourcetrigger="propertychanged"/>th                 <binding path="notperformingfocustest" updatesourcetrigger="propertychanged"/>             </multibinding>         </combobox.isenabled>     </combobox> 

thanks! buck

in style triggers set tooltip validation error when have error. can same when don't have error manipulating value property of trigger

<style x:key="standardcomboboxstyle" targettype="{x:type combobox}">     <style.triggers>         <trigger property="validation.haserror" value="true">             <setter property="tooltip" value="{binding relativesource={x:static relativesource.self}, path=(validation.errors)[0].errorcontent}"/>         </trigger>         <trigger property="validation.haserror" value="false">             <setter property="tooltip" value="my tooltip test." />         </trigger>     </style.triggers> </style> 

on note i'd recommend changing path=(validation.errors)[0].errorcontent path=(validation.errors).currentitem.errorcontent


Comments

Popular posts from this blog

java - JavaFX 2 slider labelFormatter not being used -

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -