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

Unexpected Loaded/Unloaded Events in RadGridView's Contents

1 Answer 166 Views
GridView
This is a migrated thread and some comments may be shown as answers.
s2uiguy
Top achievements
Rank 1
s2uiguy asked on 09 Jun 2011, 05:24 PM

Hi,

We have a rather large application that we are developing that has a couple of RadGridView's that are bound to an ObservableCollection of data objects.  The grid view's have one particular column that is comprised of a custom cell template.  Please see the code snippet at the bottom.   In my specific case, I have a column of cells that contain progress bars that are moving based on a timer.

The issue is that whenever the table gets an update due to a data change or even in the case when a user tries to sort the table by clicking on a column header, the contents of the custom cell is unloaded and reloaded - every update...  So, in my scenario, the progress bars just get reset because of the unload/load....

I tried to reproduce the problem with a small sample application but as I would expect, when I sort the grid view, the custom cell contents are not loaded and unloaded every time.  When I make an update to particular row only that row receives the unloaded & loaded events.  This makes sense.

Is there anything related to binding or my visual hierarchy that could be causing this? Or something else???

Thanks!

<telerik:GridViewDataColumn Header="State">
     <telerik:GridViewDataColumn.CellTemplate>
         <DataTemplate>
             <StackPanel Orientation="Vertical">
                 <TextBlock HorizontalAlignment="Center"                                       
                        Text="{Binding state}" FontSize="10"/>
                        <local:StateProgressBar x:Name="stateProgressBar" DataContext="{Binding}" Loaded="OnStateProgressBarLoadedHandler" Unloaded="stateProgressBar_Unloaded"/>
             </StackPanel>
         </DataTemplate>
     </telerik:GridViewDataColumn.CellTemplate>
 </telerik:GridViewDataColumn>

 

 

1 Answer, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 10 Jun 2011, 09:21 AM
Hello fortpointuiguy,

I am afraid that without seeing the actual application it is very difficult to pinpoint the problem. A hint that might help you find the problems is that the grid will only reload all rows if it receives CollectionChanged event with Reset action or if itsItemsSource property is reassigned. 

Hope this helps.


Greetings,
Milan
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
s2uiguy
Top achievements
Rank 1
Answers by
Milan
Telerik team
Share this question
or