c# - Create constant size Background Image in Wrap Panel in WPF -


i want implement container has list items scroll able setting wrap panel's background image image stretching according items of wrap panel. want make background fixed content can scrolled without stretching background image. using following code.

<scrollviewer x:name="imagescrollviewer" verticalscrollbarvisibility="auto" horizontalscrollbarvisibility="disabled">             <wrappanel x:name="panel" orientation="horizontal" >                 <wrappanel.background>                     <visualbrush>                         <visualbrush.visual>                             <image name="pnlbackground">                                 <image.opacitymask>                                     <lineargradientbrush startpoint="0,0.5" endpoint="1,0.5" >                                         <gradientstop offset="0.0" color="#00000000" />                                         <gradientstop offset="1.0" color="#ff000000" />                                     </lineargradientbrush>                                 </image.opacitymask>                             </image>                         </visualbrush.visual>                     </visualbrush>                 </wrappanel.background>                                     <listbox                  margin="5"                  selectionmode="extended"                  itemssource="{binding}"                  selectedindex="0"                   d:ishidden="true">                                         </listbox>             </wrappanel>         </scrollviewer> 

instead of setting background wrappanel,try set background scrollviewer.i hope solve problem.

<scrollviewer x:name="imagescrollviewer"                        verticalscrollbarvisibility="auto" horizontalscrollbarvisibility="disabled">         <scrollviewer.background>             <visualbrush>                 <visualbrush.visual>                     <image  name="pnlbackground" source="f:\\tempscreen.png">                         <image.opacitymask>                             <lineargradientbrush startpoint="0,0.5" endpoint="1,0.5" >                                 <gradientstop offset="0.0" color="#00000000" />                                 <gradientstop offset="1.0" color="#ff000000" />                             </lineargradientbrush>                         </image.opacitymask>                     </image>                 </visualbrush.visual>             </visualbrush>         </scrollviewer.background>         <wrappanel x:name="panel" orientation="horizontal" >              <listbox              margin="5"              selectionmode="extended"               selectedindex="0"               >             </listbox>         </wrappanel>     </scrollviewer> 

Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -