silverlight - Disable events on element -
i've faced problem, elements placed in other elements mess event, like:
i have code expander:
<resourcedictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:expander"> <style targettype="local:expander"> <setter property="template"> <setter.value> <controltemplate targettype="local:expander"> <grid> <visualstatemanager.visualstategroups> <visualstategroup x:name="viewstates"> <visualstategroup.transitions> <visualtransition generatedduration="0:0:0.0"/> </visualstategroup.transitions> <visualstate x:name="expanded"> <storyboard> <doubleanimation storyboard.targetname="contentscaletransform" storyboard.targetproperty="scaley" to="1" duration="0"/> </storyboard> </visualstate> <visualstate x:name="collapsed"> <storyboard> <doubleanimation storyboard.targetname="contentscaletransform" storyboard.targetproperty="scaley" to="0" duration="0"/> </storyboard> </visualstate> </visualstategroup> </visualstatemanager.visualstategroups> <border borderbrush="#ffcaadad" borderthickness="1" cornerradius="{templatebinding cornerradius}" background="{templatebinding background}"> <grid> <grid.rowdefinitions> <rowdefinition height="auto"/> <rowdefinition height="*"/> </grid.rowdefinitions> <grid background="#ffdbdbdb" margin="0"> <grid.columndefinitions> <columndefinition width="80"/> <columndefinition width="*"/> </grid.columndefinitions> <contentpresenter grid.column="0" horizontalalignment="center" grid.columnspan="2" verticalalignment="center" content="{templatebinding headercontent}" canvas.zindex="1"/> <togglebutton grid.column="0" margin="10,0,0,0" grid.columnspan="2" horizontalalignment="stretch" rendertransformorigin="0.5,0.5" x:name="expandcollapsebutton"> <togglebutton.template> <controltemplate> <grid> <visualstatemanager.visualstategroups> <visualstategroup x:name="viewstates"> <visualstategroup.transitions> <visualtransition generatedduration="0:0:0.0"/> </visualstategroup.transitions> <visualstate x:name="checked"> <storyboard> <doubleanimation storyboard.targetname="rotatebuttontransform" storyboard.targetproperty="angle" to="180" duration="0"/> </storyboard> </visualstate> <visualstate x:name="unchecked"> <storyboard> <doubleanimation storyboard.targetname="rotatebuttontransform" storyboard.targetproperty="angle" to="0" duration="0"/> </storyboard> </visualstate> </visualstategroup> </visualstatemanager.visualstategroups> <rectangle horizontalalignment="stretch" height="80" fill="#ffdbdbdb"/> <path rendertransformorigin="0.5,0.5" horizontalalignment="left" verticalalignment="center" data="m2,3l9,10 16,3" stroke="black" strokethickness="6" fill="#ffdbdbdb"> <path.rendertransform> <rotatetransform x:name="rotatebuttontransform"/> </path.rendertransform> </path> </grid> </controltemplate> </togglebutton.template> </togglebutton> </grid> <contentpresenter grid.row="1" margin="0" content="{templatebinding content}" x:name="content"> <contentpresenter.rendertransform> <scaletransform x:name="contentscaletransform"/> </contentpresenter.rendertransform> </contentpresenter> </grid> </border> </grid> </controltemplate> </setter.value> </setter> </style>
problem here:
<contentpresenter grid.column="0" horizontalalignment="center" grid.columnspan="2" verticalalignment="center" content="{templatebinding headercontent}" canvas.zindex="1"/>
it's lokated on top of toggle button, text visible, , problem:
when tap on expander if tap on place text - expander dosn't expand, if dont touch text, empty field expands. means text_tap event being triggered.
is there way disable this?
i have tried put contentpresenter button, doesn't see biding - , don't know how fix this, maybe there other options?
set text property ishittestvisible = false
Comments
Post a Comment