Welcome to the Xceed Community | Help
Community Search  
More Search Options

How to show all rows (without creating dynamically) in Datagrid

Sort Posts: Previous Next
  •  07-30-2008, 6:45 AM Post no. 13798

    How to show all rows (without creating dynamically) in Datagrid

    Updated: This post originally come from this http://xceed.com/CS/forums/13915/ShowThread.aspx#13915

    Hello,

    Let's say I have 30 records in my list and I bind this list to datagrid. The height of my datagrid is not long enough to show all rows of datagrid so only 10 rows are visible in datagird.

    When I was trying to loop through the row of datagird, I found that I got only 10 rows which are visible in datagrid. If I scroll down a bit, the row will be dynamically geneated. I don't want this feature. 

    I tried to check the rows of datagrid by using Snoop and found that the row are dynamically created when the user moves the scrollbars.

    So, my question is: How can I force the datagrid to show all rows (30 rows) even those are not visible? How can I disable "lazy-binding" from Datagrid? So, I can get all rows from looping.

    Thanks in advance.   


  •  08-11-2008, 4:05 PM Post no. 14001 in reply to 13798

    Re: How to show all rows (without creating dynamically) in Datagrid

    This is done by setting the CanContentScroll property on the ScrollViewer:

     <Style TargetType="{x:Type xcdg:TableViewScrollViewer}">
           <Setter Property="CanContentScroll"
                   Value="False" />
         </Style>

    However, I strongly recommend not disabling UI Virtualization as the performance cost can quickly become prohibitive ( load times and memory consumption ). Instead you could use handlers on the Loaded event of Controls to have access to those that becomes visible  ( without keeping any hard references since UI Elements will be reused for performance reasons ).



    Marc Laroche
    Software Developer
    Xceed Software Inc.


    I don’t suffer from insanity, I enjoy every minute of it. - Unknown
View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2010 Xceed Software Inc.