image - c# uwp Toolkit ImageEx cycle detected -
in uwp have this:
<gridview x:name="gvlist" scrollviewer.horizontalscrollbarvisibility="disabled" scrollviewer.horizontalscrollmode="disabled" scrollviewer.verticalscrollbarvisibility="hidden" scrollviewer.verticalscrollmode="enabled" verticalalignment="stretch" horizontalalignment="stretch" itemtemplate="{staticresource template}" grid.row="1" itemcontainerstyle="{staticresource listviewnoanimationstyle}"> <gridview.itemspanel> <itemspaneltemplate> <itemswrapgrid orientation="horizontal"/> </itemspaneltemplate> </gridview.itemspanel> </gridview>
my datatemplate
this:
<datatemplate x:key="template" x:datatype="data:item"> <customcontrols:customcontrol model="{x:bind mode=oneway}" width="{binding itemwidth, elementname=customlistcontrol}" height="{binding itemheight, elementname=customlistcontrol}" itempadding="{binding itempadding, elementname=customlistcontrol}"/> </datatemplate>
in customcontrol there 1 imageex control:
<controls:imageex x:name="imagebackground" source="{x:bind image, mode=oneway}" stretch="uniformtofill"/>
there more 500 items in list populating gridview.
the problem "layout cycle detected. layout not complete." error. if use image instead of imageex, working fine.
but, need use imageex because sets it's source asynchroniously, populates without blocking ui.
anyone got idea this?
thanks user avk , link https://github.com/microsoft/uwpcommunitytoolkit/issues/1328, have added style app, , fixed issue imageex layout cycle problem:
<style targettype="controls:imageex"> <setter property="background" value="transparent" /> <setter property="foreground" value="{themeresource applicationforegroundthemebrush}" /> <setter property="template"> <setter.value> <controltemplate targettype="controls:imageex"> <grid background="{templatebinding background}"> <image name="placeholderimage" horizontalalignment="{templatebinding horizontalalignment}" verticalalignment="{templatebinding verticalalignment}" opacity="1.0" source="{templatebinding placeholdersource}" stretch="{templatebinding placeholderstretch}" /> <image name="image" horizontalalignment="{templatebinding horizontalalignment}" verticalalignment="{templatebinding verticalalignment}" ninegrid="{templatebinding ninegrid}" opacity="0.0" stretch="{templatebinding stretch}" /> <progressring name="progress" margin="16" horizontalalignment="center" verticalalignment="center" background="transparent" foreground="{templatebinding foreground}" isactive="false" visibility="collapsed" /> <visualstatemanager.visualstategroups> <visualstategroup x:name="commonstates"> <visualstate x:name="failed"> <storyboard> <objectanimationusingkeyframes storyboard.targetname="image" storyboard.targetproperty="opacity"> <discreteobjectkeyframe keytime="0" value="0" /> </objectanimationusingkeyframes> <objectanimationusingkeyframes storyboard.targetname="placeholderimage" storyboard.targetproperty="opacity"> <discreteobjectkeyframe keytime="0" value="1" /> </objectanimationusingkeyframes> </storyboard> </visualstate> <visualstate x:name="loading"> <storyboard> <objectanimationusingkeyframes storyboard.targetname="progress" storyboard.targetproperty="isactive"> <discreteobjectkeyframe keytime="0" value="true" /> </objectanimationusingkeyframes> <objectanimationusingkeyframes storyboard.targetname="progress" storyboard.targetproperty="visibility"> <discreteobjectkeyframe keytime="0" value="visible" /> </objectanimationusingkeyframes> <objectanimationusingkeyframes storyboard.targetname="image" storyboard.targetproperty="opacity"> <discreteobjectkeyframe keytime="0" value="0" /> </objectanimationusingkeyframes> <objectanimationusingkeyframes storyboard.targetname="placeholderimage" storyboard.targetproperty="opacity"> <discreteobjectkeyframe keytime="0" value="1" /> </objectanimationusingkeyframes> </storyboard> </visualstate> <visualstate x:name="loaded"> <storyboard> <objectanimationusingkeyframes storyboard.targetname="progress" storyboard.targetproperty="isactive"> <discreteobjectkeyframe keytime="0" value="false" /> </objectanimationusingkeyframes> <objectanimationusingkeyframes storyboard.targetname="progress" storyboard.targetproperty="visibility"> <discreteobjectkeyframe keytime="0" value="collapsed" /> </objectanimationusingkeyframes> <doubleanimation autoreverse="false" begintime="0" storyboard.targetname="image" storyboard.targetproperty="opacity" from="0" to="1" /> <doubleanimation autoreverse="false" begintime="0" storyboard.targetname="placeholderimage" storyboard.targetproperty="opacity" from="1" to="0" /> </storyboard> </visualstate> <visualstate x:name="unloaded" /> </visualstategroup> </visualstatemanager.visualstategroups> </grid> </controltemplate> </setter.value> </setter> </style>
Comments
Post a Comment