xaml - WPF Scroll a Uniformgrid -


i need display files located in specific path. have created user control contains textblocks details of file (name, size, extension, etc), control child of uniform grid.

the problem is, if uniformgrid 5x5, , have on 25 files, 26th element not shown.

i'd know, there way scroll content of uniform grid?

i know can use listbox , binding (i'm still reading it), need add controls programmatically, 'cause control has event, , i'm subscribing when new instance of usercontrol created , added child array.

i've seen this post, , placed uniforgrid inside itemscontrol, not work @ all, xaml:

<scrollviewer grid.column="1" verticalscrollbarvisibility="auto" horizontalscrollbarvisibility="disabled" >     <itemscontrol x:name="gridarchivos">         <itemscontrol.itemspanel >             <itemspaneltemplate >                 <uniformgrid columns="5" />             </itemspaneltemplate>         </itemscontrol.itemspanel>     </itemscontrol>                     </scrollviewer> 

according post, cols or rows need specified, never both. so, 5 cols. don't want hrizontal scrolling, vertical.

thanks time.

i copied xaml , seems work expected

here test code incase helps diagnose problem

xaml:

<window x:class="wpfapplication7.mainwindow"         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"         title="mainwindow" height="350" width="525" name="ui">     <scrollviewer verticalscrollbarvisibility="auto" horizontalscrollbarvisibility="disabled" >         <itemscontrol itemssource="{binding items, elementname=ui}">             <itemscontrol.itemspanel >                 <itemspaneltemplate >                     <uniformgrid columns="5"  />                 </itemspaneltemplate>             </itemscontrol.itemspanel>         </itemscontrol>     </scrollviewer> </window> 

code:

public partial class mainwindow : window {     public mainwindow()     {         initializecomponent();         (int = 0; < 1000; i++)         {             items.add("stackoverflow"+i);         }     }      private observablecollection<string> items = new observablecollection<string>();     public observablecollection<string> items     {         { return items; }         set { items = value; }     } } 

result:

enter image description here


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -