xaml - Binding the ZIndex of items in an ItemsControl -


using caliburn.micro winrt application, control zindex of items displays in itemscontrol. when user taps on item, should become topmost element.

        <itemscontrol background="white" height="auto" width="auto"  x:name="parts"                   horizontalalignment="left"                   verticalalignment="top"                        >             <itemscontrol.itemspanel>                 <itemspaneltemplate>                         <canvas></canvas>                 </itemspaneltemplate>             </itemscontrol.itemspanel>         </itemscontrol> 

the viewmodel bound view above contains property parts:

    private bindablecollection<ipartviewmodel> _parts = new bindablecollection<ipartviewmodel>();     public bindablecollection<ipartviewmodel> parts     {         { return _parts; }         set { _parts = value; notifyofpropertychange(() => parts); }     } 

ipartviewmodel has different implementations, each own view (= custom user controls). every implementation of ipartviewmodel has zindex property, ready bound.

all other bindings (labels, tapped event, ...) work perfectly, cannot figure out binding should control zindex.

many other questions on deal issue, none winrt.

i ended achieving custom itemscontrol , overriding method getcontainerforitemoverride return contentpresenter binding added zindex property

protected override dependencyobject getcontainerforitemoverride()         {             var cp = new contentpresenter();             cp.setbinding(canvas.zindexproperty, new binding { path = new propertypath("zindex") });             return cp;         } 

Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -