C# .Net WPF Custom User Control zIndex issue with similar user control -


user control details:

have created drop down list control (like combo box), clicking on down arrow button, displays list below text box

i have set zindex property of user control

issue:

case 1: when there user control (other custom user control), , if drop down list displayed, other user control hides behind user control. ok

case 2: there 2 custom user controls, if list displayed first user control, second user control appears on list. facing issue

xaml of control below

    <usercontrolx:class="usercontrols.autocompletecombobox"     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"     panel.zindex="1110" lostfocus="usercontrol_lostfocus" height="auto">          <canvas name="maincanvas">             <grid>                 <grid.rowdefinitions>                     <rowdefinition></rowdefinition>                     <rowdefinition></rowdefinition>                 </grid.rowdefinitions>                 <grid.columndefinitions>                     <columndefinition width="auto" minwidth="150"></columndefinition>                     <columndefinition width="20"></columndefinition>                 </grid.columndefinitions>                 <textbox name="autotextbox" height="20" minwidth="150" width="auto" minheight="20" style="{dynamicresource autocompletebox}" borderthickness="2"                      margin="0,0,0,0" textwrapping="nowrap"  grid.row="0" grid.column="0" horizontalalignment="stretch" verticalalignment="top"/>                 <button content="6" fontfamily="marlett" grid.row="0" grid.column="1" fontsize="15" margin="0,0,0,0" height="20" width="20" horizontalalignment="right" verticalalignment="top" background="{staticresource backgroudbluebrush}"  click="button_click" padding="0" cursor="hand"></button>                 <stackpanel grid.row="1" grid.columnspan="2" >                     <listbox name="suggestionlistbox" selectionchanged="suggestionlistbox_selectionchanged" mousedown="suggestionlistbox_mousedown"                      background="lightyellow" snapstodevicepixels="true"                      visibility="collapsed"                       minwidth="150" ishittestvisible="true" minheight="70" height="70"                      verticalalignment="top" lostfocus="suggestionlistbox_lostfocus"/>                 </stackpanel>             </grid>         </canvas> </usercontrol> 

your approach not right 1 correctly manage overlap of controls. perhaps may create trick using zindex property, won't solution.

if need drop-down control, best way use popup control , play around it. basically, creates borderless window, being child of yours.

another approach, maybe simpler not popup, using adorner. maybe 1 similar techinique yours.

cheers


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -