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

Expandable Icon shows if no child records are available

3 Answers 117 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
ATeam
Top achievements
Rank 1
ATeam asked on 22 Aug 2012, 07:56 AM
Hello,

I have a page which uses the VQCV (Load on Demand) mechanism from telerik with a silverlight RadGridView with Hierarchy.

I have found the "IsExpandableBehavior" somewhere on your blogs or forum and use it with success. It works fine for the first visit on the page, every row/dataItem which has childs show the expandable Icon and for thoose rows which dont have childs dont show the icon.


But if I try to do any sorting or filtering the VQCV will be triggered to releod the data for the gridView. After that reload the gridview shows in every second (alternating) row the expandable Icon. But the property which I used for the IsExpandableBehavior returns false.

I also tried to set IsExpandable in the RowLoaded event but there is another mystery, because the RowLoaded event will only be fired for the half of the rows which will be shown on the screen. Which explains why every second row has a visible Expandable Icon.

Do you know anything about such a behavior? Can you give me a solution how to hide the expandable Icons?

Here is the XAML for the RadGridView:

<tg:RadGridView x:Name="GridSectionWorklist"
                    Grid.Row="1"
                    Margin="0"
                    HorizontalAlignment="Stretch"
                    VerticalAlignment="Stretch"
                    AutoGenerateColumns="False"
                    CanUserDeleteRows="False"
                    CanUserInsertRows="False"
                    CanUserResizeRows="False"
                    CanUserSelect="False"
                    DataLoadMode="Synchronous"
                    EnableColumnVirtualization="True"
                    EnableRowVirtualization="True"
                    GridLinesVisibility="Horizontal"
                    IsReadOnly="True"
                    ItemsSource="{Binding CollectionView}"
                    RowLoaded="gridView_RowLoaded"
                    Loaded="GridSectionWorklist_Loaded"
                    RowUnloaded="GridSectionWorklist_RowUnloaded"
                    ReorderColumnsMode="DropIndicator"
                    RowIndicatorVisibility="Collapsed"
                    DataLoading="GridSectionWorklist_DataLoading"
                    DataLoaded="GridSectionWorklist_DataLoaded"
                    RowIsExpandedChanged="GridSectionWorklist_RowIsExpandedChanged"
                    RowIsExpandedChanging="GridSectionWorklist_RowIsExpandedChanging"
                    ScrollMode="RealTime"
                    ShowColumnFooters="True">
<swi:Interaction.Behaviors>
        <CustomTelerik:IsExpandableBehavior IsExpandableSourcePropertyName="HaveRevisions" />
</swi:Interaction.Behaviors>
      <tg:RadGridView.Columns>
<!-- columns ... -->
      </tg:RadGridView.Columns>
 <tg:RadGridView.ChildTableDefinitions>
        <tg:GridViewTableDefinition />
      </tg:RadGridView.ChildTableDefinitions>
      <tg:RadGridView.HierarchyChildTemplate>
        <DataTemplate>
<tg:RadGridView.ChildTableDefinitions>
        <tg:GridViewTableDefinition />
      </tg:RadGridView.ChildTableDefinitions>
      <tg:RadGridView.HierarchyChildTemplate>
        <DataTemplate>
          <tg:RadGridView AutoGenerateColumns="False"
                                         IsReadOnly="True"
                                         ItemsSource="{Binding NewerRevisions}"
                                         RowIndicatorVisibility="Collapsed"
                                         RowLoaded="RadGridView_RowLoaded"
                                         ShowGroupPanel="False">
            <tg:RadGridView.ChildTableDefinitions>
              <tg:GridViewTableDefinition />
            </tg:RadGridView.ChildTableDefinitions>
            <tg:RadGridView.Columns>
<!-- columns ... -->
            </tg:RadGridView.Columns>
</tg:RadGridView>
        </DataTemplate>
      </tg:RadGridView.HierarchyChildTemplate>
    </tg:RadGridView>

Kind Regards!

3 Answers, 1 is accepted

Sort by
0
Nick
Telerik team
answered on 27 Aug 2012, 06:31 AM
Hello Dominik,

Unfortunately, we are unable to determine what is wrong, based on the provided snippet and information.
Would it be possible to share some more information regarding the project? Are you setting the IsExpandable property anywhere in your code? 

As to the row loaded not being fired for all the items in the grid view, this is the expected behavior when the RowVirtualiazation is enabled. Let me try to elaborate. In the cases where the virtualization is active, the grid view creates rows only for the items that are actually going to be displayed in the view port, so if you have, lets say 100 items, and the grid view is displaying 20 at a time, the row loaded event will be fired only for those 20 that are going to be shown in the first rendering of the GridView. Respectively the event is fired constantly while scrolling since the grid view virtualizing panel is creating new rows for the items that are being brought into view.

Hope this makes sense! 

All the best,
Nik
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
ATeam
Top achievements
Rank 1
answered on 27 Aug 2012, 07:08 AM
Hello Nik!

I don't set the IsExpandable Property anywhere else beside the IsExpandableBehavior. (Not in Code behinde just in the Behavior). 

But I've also tested it to set it without the Behavior in the Code behind file. This doesn't work also! In this case I recognized the strange behavior that the RowLoaded is not fired for every row. I mean not every row in the view port. I know that with virtualization only the rows in the viewport are loaded, but the strange thing is, that only the half of the rows from the viewport are loaded.
For example: Total Rows are 30 and in the viewport are 16. The rowsLoaded Event only fires 8 times. - > For me it seems that every AlternatingRow is loaded...

And here the next strange thing: All this just happens if i make a reload of the data, like adding a sort descriptor on any column. If i just load the data the first time the IsExpandable Property works as expected. If i do a reload every second/alternating row shows the "Expandable" icon.

Background Info: I use virtualization (VQCV with WCF Services).

Do you know something about that?

Kind Regards!
0
Nick
Telerik team
answered on 29 Aug 2012, 02:13 PM
Hello Dominik,

May I ask you to send a small runnable project replicating the issue, since it looks like that the problem could be more complicated than anticipated. To do that, you will have to open a support ticket since the Forums don't allow uploading projects.

Looking forward to hearing from you! 

Greetings,
Nik
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
ATeam
Top achievements
Rank 1
Answers by
Nick
Telerik team
ATeam
Top achievements
Rank 1
Share this question
or