This is a migrated thread and some comments may be shown as answers.

Loading more items row indicator

3 Answers 92 Views
GridView
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 18 Aug 2010, 12:09 PM
Hi Telerik,
I'm working on a project that needs to load a massive amount of data into the grid.
The data loading is divided into two chunks: the first chunk will bring only several rows for the user to be able to start working with.
The second chunk will load the rest of the data in a separate thread.

While loading the first chunk I'm setting the IsBusy property to true.
Once the first chunk is loaded isBusy is false (the user should be able to start working), and I want to "add" a row to the end of the grid's rows collection that will represent a loading indicator (like in the iPhone) - this is exactly like in the iPhone (see attachment).

I tried to make modifications in the grid's GridViewScrollViewer template by changing the content of the ScrollContentPresenter to contain a ContentPresenter with the loading indicator below it (I made it a button for simplicity).
<ScrollContentPresenter
    Grid.Row="2"
    CanContentScroll="{TemplateBinding CanContentScroll}"
    CanHorizontallyScroll="False"
    CanVerticallyScroll="False">
    <ScrollContentPresenter.Content>
        <StackPanel Orientation="Vertical">
            <ContentPresenter
                ContentTemplate="{TemplateBinding ContentTemplate}"
                Content="{TemplateBinding Content}"
                ContentStringFormat="{TemplateBinding ContentStringFormat}" />

      <!-- Loading indicator -->
                <Button
                    Content="Loading..." />
        </StackPanel>
    </ScrollContentPresenter.Content>
</ScrollContentPresenter>

This works well when applied to a regular ScrollViewer's template, but on GridViewScrollViewer template it throws an exception:
In a FrameworkTemplate, ContentPresenter and GridViewRowPresenter cannot be in each other inclusively or exclusively.

Please help!!
Regards,

David.

3 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 18 Aug 2010, 01:44 PM
Hello David,

 Generally you do not need to modify the grid template in order to achieve this - you can do this completely at data source level. Please check this blog post for more info. 

Regards,
Vlad
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
David
Top achievements
Rank 1
answered on 18 Aug 2010, 02:30 PM
Hi Vlad,
I'm fine with the data retrieval implementation, but adding a dummy data to my source is not an option for me.
I need something as simple as setting a property (even an attached property).

I'm afraid that the only option for me is changing the template.
Is there a way to make it work?

Regards,
David.
0
Vlad
Telerik team
answered on 20 Aug 2010, 12:22 PM
Hello,

 You can try also this approach if you want custom scrolling. 

Greetings,
Vlad
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
David
Top achievements
Rank 1
Answers by
Vlad
Telerik team
David
Top achievements
Rank 1
Share this question
or