wpf - Unable to drag drop items between bound itemscontrols -


iv'e got several bound itemscontrols play role of of drop target need able drag drop items between these items controls .

the problem items control's not recognized drop targets drag drop framework

the itemscontrol panel :

    <itemspaneltemplate x:key="toppipepaneltemplate">             <stackpanel></stackpanel>     </itemspaneltemplate> 

the datatemplate :

    <datatemplate x:key="pipedataitem" >         <ellipse width="45" height="45" fill="{binding ismine,converter={staticresource mycheckerownertocolorconverter}}"></ellipse>     </datatemplate> 

the itemscontrol style :

    <style targettype="{x:type itemscontrol}" x:key="itemscontrolstyle">           <setter property="itemtemplate" value="{staticresource pipedataitem}"></setter>           <setter property="allowdrop" value="true"></setter>                                                 <eventsetter event="drop" handler="itemscontroldroptarget"></eventsetter>            <eventsetter event="previewmouseleftbuttondown" handler="itemscontrol_mouseleftbuttondown"></eventsetter>           </style> 

** example lets take 2 of itemscontrols :**

    <itemscontrol itemssource="{binding path=pipes[23].checkers}" style="{staticresource itemscontrolstyle}"/>     <itemscontrol grid.column="1" itemssource="{binding path=pipes[22].checkers}" style="{staticresource itemscontrolstyle}"/> 

when regularly displayed :

enter image description here

the empty ( left ) 1 not recognized drop target although allowdrop set true , handles drop event ( itemscontrols in screen , @ itemscontrol style above )

now when color itemscontrol panel s recognized :

    <itemspaneltemplate x:key="toppipepaneltemplate">             <stackpanel background="aliceblue"></stackpanel>     </itemspaneltemplate> 

enter image description here

as if takes entire cell occupies .. iv'e tried setting panel verticalalignment="stretch" had no affect

i'm trying understand why itemcontrols not recognized drop enabled , though expect take space , in addition itemscontrol ellipses recognized until height of ellipses occupie it's content .

any ideas ?

just clarify mean recognized drop target when drag ellipse able drop on top of itemscontrol .

for iv'e set background transparent

the default background color of panel doesn't exist, means hit tests pass through it. register hit tests, such mouse on events, need give background color. use white, although said transparent works , better choice.

in addition, stackpanels take space need. might better off using panel stretches fill available space, such dockpanel lastchildfill="false", , set dockpanel.dock="top" on items


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -