c# - GridView Item's "ItemClick event" is not compiled - due to the applied styles? -
here current style used (mostly template)
<style x:key="panoramagridviewitemstyle1" targettype="gridviewitem"> <setter property="fontfamily" value="{staticresource contentcontrolthemefontfamily}"/> <setter property="fontsize" value="{staticresource controlcontentthemefontsize}"/> <setter property="background" value="transparent"/> <setter property="tabnavigation" value="local"/> <setter property="isholdingenabled" value="true"/> <setter property="margin" value="0,0,2,2"/> <setter property="template"> <setter.value> <controltemplate targettype="gridviewitem"> <border x:name="outercontainer"> <visualstatemanager.visualstategroups> <visualstategroup x:name="commonstates"> <visualstate x:name="normal"/> <visualstate x:name="pointerover"> <storyboard> <doubleanimation duration="0" to="1" storyboard.targetproperty="opacity" storyboard.targetname="pointeroverborder"/> <objectanimationusingkeyframes storyboard.targetproperty="fill" storyboard.targetname="selectionbackground"> <discreteobjectkeyframe keytime="0" value="{staticresource listviewitemselectedpointeroverbackgroundthemebrush}"/> </objectanimationusingkeyframes> <objectanimationusingkeyframes storyboard.targetproperty="stroke" storyboard.targetname="selectedborder"> <discreteobjectkeyframe keytime="0" value="{staticresource listviewitemselectedpointeroverborderthemebrush}"/> </objectanimationusingkeyframes> <objectanimationusingkeyframes storyboard.targetproperty="fill" storyboard.targetname="selectedearmark"> <discreteobjectkeyframe keytime="0" value="{staticresource listviewitemselectedpointeroverbackgroundthemebrush}"/> </objectanimationusingkeyframes> </storyboard> </visualstate> <visualstate x:name="pressed"> <storyboard> <pointerdownthemeanimation targetname="contentcontainer"/> </storyboard> </visualstate> <!--<visualstate x:name="pointeroverpressed"> <storyboard> <pointerdownthemeanimation targetname="contentcontainer"/> <doubleanimation duration="0" to="1" storyboard.targetproperty="opacity" storyboard.targetname="pointeroverborder"/> <objectanimationusingkeyframes storyboard.targetproperty="fill" storyboard.targetname="selectionbackground"> <discreteobjectkeyframe keytime="0" value="{staticresource listviewitemselectedpointeroverbackgroundthemebrush}"/> </objectanimationusingkeyframes> <objectanimationusingkeyframes storyboard.targetproperty="stroke" storyboard.targetname="selectedborder"> <discreteobjectkeyframe keytime="0" value="{staticresource listviewitemselectedpointeroverborderthemebrush}"/> </objectanimationusingkeyframes> <objectanimationusingkeyframes storyboard.targetproperty="fill" storyboard.targetname="selectedearmark"> <discreteobjectkeyframe keytime="0" value="{staticresource listviewitemselectedpointeroverbackgroundthemebrush}"/> </objectanimationusingkeyframes> </storyboard> </visualstate>--> <visualstate x:name="disabled"> <storyboard> <doubleanimation duration="0" to="{staticresource listviewitemdisabledthemeopacity}" storyboard.targetproperty="opacity" storyboard.targetname="contentpresenter"/> </storyboard> </visualstate> </visualstategroup> <visualstategroup x:name="focusstates"> <visualstate x:name="focused"> <storyboard> <doubleanimation duration="0" to="1" storyboard.targetproperty="opacity" storyboard.targetname="focusvisual"/> </storyboard> </visualstate> <visualstate x:name="unfocused"/> <visualstate x:name="pointerfocused"/> </visualstategroup> <!--<visualstategroup x:name="selectionhintstates"> <visualstategroup.transitions> <visualtransition generatedduration="0:0:0.65" to="noselectionhint"/> </visualstategroup.transitions> <visualstate x:name="verticalselectionhint"> <storyboard> <swipehintthemeanimation tohorizontaloffset="0" targetname="selectionbackground" toverticaloffset="15"/> <swipehintthemeanimation tohorizontaloffset="0" targetname="contentborder" toverticaloffset="15"/> <swipehintthemeanimation tohorizontaloffset="0" targetname="selectedborder" toverticaloffset="15"/> <swipehintthemeanimation tohorizontaloffset="0" targetname="selectedcheckmark" toverticaloffset="15"/> <doubleanimationusingkeyframes duration="0:0:0.500" storyboard.targetproperty="opacity" storyboard.targetname="hintglyph"> <discretedoublekeyframe keytime="0:0:0" value="0.5"/> <discretedoublekeyframe keytime="0:0:0.500" value="0"/> </doubleanimationusingkeyframes> </storyboard> </visualstate> <visualstate x:name="horizontalselectionhint"> <storyboard> <swipehintthemeanimation tohorizontaloffset="-23" targetname="selectionbackground" toverticaloffset="0"/> <swipehintthemeanimation tohorizontaloffset="-23" targetname="contentborder" toverticaloffset="0"/> <swipehintthemeanimation tohorizontaloffset="-23" targetname="selectedborder" toverticaloffset="0"/> <swipehintthemeanimation tohorizontaloffset="-23" targetname="selectedcheckmark" toverticaloffset="0"/> <doubleanimationusingkeyframes duration="0:0:0.500" storyboard.targetproperty="opacity" storyboard.targetname="hintglyph"> <discretedoublekeyframe keytime="0:0:0" value="0.5"/> <discretedoublekeyframe keytime="0:0:0.500" value="0"/> </doubleanimationusingkeyframes> </storyboard> </visualstate> <visualstate x:name="noselectionhint"/> </visualstategroup>--> <visualstategroup x:name="selectionstates"> <visualstate x:name="unselecting"> <storyboard> <doubleanimation duration="0" to="1" storyboard.targetproperty="opacity" storyboard.targetname="hintglyphborder"/> </storyboard> </visualstate> <visualstate x:name="unselected"> <storyboard> <doubleanimation duration="0" to="1" storyboard.targetproperty="opacity" storyboard.targetname="hintglyphborder"/> </storyboard> </visualstate> <visualstate x:name="unselectedpointerover"> <storyboard> <doubleanimation duration="0" to="1" storyboard.targetproperty="opacity" storyboard.targetname="hintglyphborder"/> <objectanimationusingkeyframes storyboard.targetproperty="foreground" storyboard.targetname="contentpresenter"> <discreteobjectkeyframe keytime="0" value="{staticresource listviewitemselectedforegroundthemebrush}"/> </objectanimationusingkeyframes> </storyboard> </visualstate> <visualstate x:name="unselectedswiping"> <storyboard> <doubleanimation duration="0" to="0.5" storyboard.targetproperty="opacity" storyboard.targetname="selectingglyph"/> <doubleanimation duration="0" to="1" storyboard.targetproperty="opacity" storyboard.targetname="hintglyphborder"/> </storyboard> </visualstate> <visualstate x:name="selecting"> <storyboard> <doubleanimation duration="0" to="1" storyboard.targetproperty="opacity" storyboard.targetname="selectionbackground"/> <doubleanimation duration="0" to="1" storyboard.targetproperty="opacity" storyboard.targetname="selectedborder"/> <doubleanimation duration="0" to="1" storyboard.targetproperty="opacity" storyboard.targetname="selectingglyph"/> <doubleanimation duration="0" to="1" storyboard.targetproperty="opacity" storyboard.targetname="hintglyphborder"/> <objectanimationusingkeyframes storyboard.targetproperty="foreground" storyboard.targetname="contentpresenter"> <discreteobjectkeyframe keytime="0" value="{staticresource listviewitemselectedforegroundthemebrush}"/> </objectanimationusingkeyframes> </storyboard> </visualstate> <visualstate x:name="selected"> <storyboard> <doubleanimation duration="0" to="1" storyboard.targetproperty="opacity" storyboard.targetname="selectionbackground"/> <doubleanimation duration="0" to="1" storyboard.targetproperty="opacity" storyboard.targetname="selectedborder"/> <doubleanimation duration="0" to="1" storyboard.targetproperty="opacity" storyboard.targetname="selectedcheckmark"/> <objectanimationusingkeyframes storyboard.targetproperty="foreground" storyboard.targetname="contentpresenter"> <discreteobjectkeyframe keytime="0" value="{staticresource listviewitemselectedforegroundthemebrush}"/> </objectanimationusingkeyframes> </storyboard> </visualstate> <!--<visualstate x:name="selectedswiping"> <storyboard> <doubleanimation duration="0" to="1" storyboard.targetproperty="opacity" storyboard.targetname="selectionbackground"/> <doubleanimation duration="0" to="1" storyboard.targetproperty="opacity" storyboard.targetname="selectedborder"/> <doubleanimation duration="0" to="1" storyboard.targetproperty="opacity" storyboard.targetname="selectedcheckmark"/> <objectanimationusingkeyframes storyboard.targetproperty="foreground" storyboard.targetname="contentpresenter"> <discreteobjectkeyframe keytime="0" value="{staticresource listviewitemselectedforegroundthemebrush}"/> </objectanimationusingkeyframes> </storyboard> </visualstate>--> <!--<visualstate x:name="selectedunfocused"> <storyboard> <doubleanimation duration="0" to="1" storyboard.targetproperty="opacity" storyboard.targetname="selectionbackground"/> <doubleanimation duration="0" to="1" storyboard.targetproperty="opacity" storyboard.targetname="selectedborder"/> <doubleanimation duration="0" to="1" storyboard.targetproperty="opacity" storyboard.targetname="selectedcheckmark"/> <objectanimationusingkeyframes storyboard.targetproperty="foreground" storyboard.targetname="contentpresenter"> <discreteobjectkeyframe keytime="0" value="{staticresource listviewitemselectedforegroundthemebrush}"/> </objectanimationusingkeyframes> </storyboard> </visualstate>--> </visualstategroup> <visualstategroup x:name="dragstates"> <visualstategroup.transitions> <visualtransition generatedduration="0:0:0.2" to="notdragging"/> </visualstategroup.transitions> <visualstate x:name="notdragging"/> <visualstate x:name="dragging"> <storyboard> <doubleanimation duration="0" to="{staticresource listviewitemdragthemeopacity}" storyboard.targetproperty="opacity" storyboard.targetname="innerdragcontent"/> <dragitemthemeanimation targetname="innerdragcontent"/> <fadeoutthemeanimation targetname="selectedcheckmarkouter"/> <fadeoutthemeanimation targetname="selectedborder"/> </storyboard> </visualstate> <visualstate x:name="draggingtarget"> <storyboard> <droptargetitemthemeanimation targetname="outercontainer"/> </storyboard> </visualstate> <visualstate x:name="multipledraggingprimary"> <storyboard> <doubleanimation duration="0" to="1" storyboard.targetproperty="opacity" storyboard.targetname="multiarrangeoverlaybackground"/> <doubleanimation duration="0" to="1" storyboard.targetproperty="opacity" storyboard.targetname="multiarrangeoverlaytext"/> <doubleanimation duration="0" to="{staticresource listviewitemdragthemeopacity}" storyboard.targetproperty="opacity" storyboard.targetname="contentborder"/> <fadeinthemeanimation targetname="multiarrangeoverlaybackground"/> <fadeinthemeanimation targetname="multiarrangeoverlaytext"/> <dragitemthemeanimation targetname="contentborder"/> <fadeoutthemeanimation targetname="selectionbackground"/> <fadeoutthemeanimation targetname="selectedcheckmarkouter"/> <fadeoutthemeanimation targetname="selectedborder"/> <fadeoutthemeanimation targetname="pointeroverborder"/> </storyboard> </visualstate> <visualstate x:name="multipledraggingsecondary"> <storyboard> <fadeoutthemeanimation targetname="contentcontainer"/> </storyboard> </visualstate> </visualstategroup> <visualstategroup x:name="reorderhintstates"> <visualstategroup.transitions> <visualtransition generatedduration="0:0:0.2" to="noreorderhint"/> </visualstategroup.transitions> <visualstate x:name="noreorderhint"/> <visualstate x:name="bottomreorderhint"> <storyboard> <dragoverthemeanimation direction="bottom" tooffset="{staticresource listviewitemreorderhintthemeoffset}" targetname="reorderhintcontent"/> </storyboard> </visualstate> <visualstate x:name="topreorderhint"> <storyboard> <dragoverthemeanimation direction="top" tooffset="{staticresource listviewitemreorderhintthemeoffset}" targetname="reorderhintcontent"/> </storyboard> </visualstate> <visualstate x:name="rightreorderhint"> <storyboard> <dragoverthemeanimation direction="right" tooffset="{staticresource listviewitemreorderhintthemeoffset}" targetname="reorderhintcontent"/> </storyboard> </visualstate> <visualstate x:name="leftreorderhint"> <storyboard> <dragoverthemeanimation direction="left" tooffset="{staticresource listviewitemreorderhintthemeoffset}" targetname="reorderhintcontent"/> </storyboard> </visualstate> </visualstategroup> <visualstategroup x:name="datavirtualizationstates"> <visualstate x:name="dataavailable"/> <visualstate x:name="dataplaceholder"> <storyboard> <objectanimationusingkeyframes duration="0" storyboard.targetproperty="visibility" storyboard.targetname="placeholdertextblock"> <discreteobjectkeyframe keytime="0"> <discreteobjectkeyframe.value> <visibility>visible</visibility> </discreteobjectkeyframe.value> </discreteobjectkeyframe> </objectanimationusingkeyframes> <objectanimationusingkeyframes duration="0" storyboard.targetproperty="visibility" storyboard.targetname="placeholderrect"> <discreteobjectkeyframe keytime="0"> <discreteobjectkeyframe.value> <visibility>visible</visibility> </discreteobjectkeyframe.value> </discreteobjectkeyframe> </objectanimationusingkeyframes> </storyboard> </visualstate> </visualstategroup> </visualstatemanager.visualstategroups> <grid x:name="reorderhintcontent" background="transparent"> <path x:name="selectingglyph" data="f1 m133.1,17.9 l137.2,13.2 l144.6,19.6 l156.4,5.8 l161.2,9.9 l145.6,28.4 z" fill="{staticresource listviewitemcheckselectingthemebrush}" flowdirection="lefttoright" horizontalalignment="right" height="13" margin="0,9.5,9.5,0" opacity="0" stretch="fill" verticalalignment="top" width="15"/> <border x:name="hintglyphborder" horizontalalignment="right" height="40" margin="4" opacity="0" verticalalignment="top" width="40"> <path x:name="hintglyph" data="f1 m133.1,17.9 l137.2,13.2 l144.6,19.6 l156.4,5.8 l161.2,9.9 l145.6,28.4 z" fill="{staticresource listviewitemcheckhintthemebrush}" flowdirection="lefttoright" horizontalalignment="right" height="13" margin="0,5.5,5.5,0" opacity="0" stretch="fill" verticalalignment="top" width="15"/> </border> <border x:name="contentcontainer"> <grid x:name="innerdragcontent"> <rectangle x:name="pointeroverborder" fill="{staticresource listviewitempointeroverbackgroundthemebrush}" ishittestvisible="false" margin="1" opacity="0"/> <rectangle x:name="focusvisual" ishittestvisible="false" opacity="0" stroke="{staticresource listviewitemfocusborderthemebrush}" strokethickness="2"/> <rectangle x:name="selectionbackground" fill="{staticresource listviewitemselectedbackgroundthemebrush}" margin="4" opacity="0"/> <border x:name="contentborder" borderbrush="{templatebinding borderbrush}" borderthickness="{templatebinding borderthickness}" background="{templatebinding background}" margin="4"> <grid> <contentpresenter x:name="contentpresenter" contenttransitions="{templatebinding contenttransitions}" horizontalalignment="{templatebinding horizontalcontentalignment}" margin="{templatebinding padding}" verticalalignment="{templatebinding verticalcontentalignment}"/> <textblock x:name="placeholdertextblock" foreground="{x:null}" ishittestvisible="false" margin="{templatebinding padding}" text="xg" visibility="collapsed"/> <rectangle x:name="placeholderrect" fill="{staticresource listviewitemplaceholderbackgroundthemebrush}" ishittestvisible="false" visibility="collapsed"/> <rectangle x:name="multiarrangeoverlaybackground" fill="{staticresource listviewitemdragbackgroundthemebrush}" ishittestvisible="false" opacity="0"/> </grid> </border> <rectangle x:name="selectedborder" ishittestvisible="false" margin="4" opacity="0" stroke="{staticresource listviewitemselectedbackgroundthemebrush}" strokethickness="{staticresource gridviewitemselectedborderthemethickness}"/> <border x:name="selectedcheckmarkouter" horizontalalignment="right" ishittestvisible="false" margin="4" verticalalignment="top"> <grid x:name="selectedcheckmark" height="40" opacity="0" width="40"> <path x:name="selectedearmark" data="m0,0 l40,0 l40,40 z" fill="{staticresource listviewitemselectedbackgroundthemebrush}" stretch="fill"/> <path data="f1 m133.1,17.9 l137.2,13.2 l144.6,19.6 l156.4,5.8 l161.2,9.9 l145.6,28.4 z" fill="{staticresource listviewitemcheckthemebrush}" flowdirection="lefttoright" horizontalalignment="right" height="13" margin="0,5.5,5.5,0" stretch="fill" verticalalignment="top" width="15"/> </grid> </border> <textblock x:name="multiarrangeoverlaytext" foreground="{staticresource listviewitemdragforegroundthemebrush}" fontsize="26.667" fontfamily="{staticresource contentcontrolthemefontfamily}" ishittestvisible="false" margin="18,9,0,0" opacity="0" textwrapping="wrap" text="{binding templatesettings.dragitemscount, relativesource={relativesource mode=templatedparent}}" texttrimming="wordellipsis"/> </grid> </border> </grid> </border> </controltemplate> </setter.value> </setter> </style>
i don't know part of style banning itemclick event (if any) being compiled , if point out ones should remove great ,
i can't see why style 'ban' click event on items, tried code style , worked fine:
<gridview isitemclickenabled="true" itemclick="gridview_itemclick"> <gridviewitem style="{staticresource panoramagridviewitemstyle1}"> <textblock>test</textblock> </gridviewitem> <gridviewitem> <textblock>test</textblock> </gridviewitem>
any chance forgot 'isitemclickenabled' property? should set true in case :)
best of luck
Comments
Post a Comment