locked
Cycling Through Paged DataGrid RRS feed

  • Question

  • Hello, I am developing some digital signage in Silverlight that I completed in asp.net but I want to get rid of the postbacks so I am redesigning the project in Silverlight.

    I have a datagrid and data pager that is bound to a paged collection view.

    After 8 seconds have elapsed I would like to go to the next page of the page collection and display the next set of data.  What do I need to reference to get this figured out?

    Thanks in advance.

    Thursday, September 13, 2012 12:44 PM

Answers

  • I got it figured out.  That was way easier than I first expected!

    First, I added a StoryBoard with a DoubleAnimation:

            <Storyboard x:Name="GridTimer" BeginTime="0:0:8">
                <DoubleAnimation 
                    Duration="00:00:2" 
                    x:Name="DoubleAnimation1" 
                    Storyboard.TargetName="TargetDataGrid" 
                    From="1.0" To="0.0"
                    Storyboard.TargetProperty="Opacity" />
            </Storyboard>
        </UserControl.Resources>


     Then I added this to the code behind:

        Private Sub UserControl_Loaded(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles MyBase.Loaded
            mService.GetDataAsync()
            GridTimer.Begin()
        End Sub
    
        Private Sub GridTimer_Completed(sender As System.Object, e As System.EventArgs) Handles GridTimer.Completed
            AddOneMore()
            GridTimer.Stop()
            GridTimer.Begin()
    
        End Sub
    
        Private Sub AddOneMore()
            If dataPager1.PageCount - 1 = CurrentPage Then
                CurrentPage = 0
                dataPager1.PageIndex = CurrentDocketsPage
            Else
                CurrentPage += 1
                dataPager1.PageIndex = CurrentPage
            End If
        End Sub



    Thursday, September 13, 2012 3:14 PM