4 Answers, 1 is accepted
You may take a look at our online demo that shows exactly what you need - hiding the toggle button for those rows that do not have child hierarchy. The relevant code is in the RowLoaded event handler.
I hope that helps.
Maya
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.
In your case when data is loaded asynchronous, the method you have chosen with Converter and setting the binding to the count of the child is quite appropriate. However, we apply some custom logic into the property IsExpandable and that is why it does not work when it is defined in xaml.
What you need to do is to set the binding in the code-behind.
I am sending you a sample project so that you can test the proposed solution.
In this project two possible approaches are implemented and you are free to use whichever you prefer.
The first one is to attach behaviors and to defined them in xaml. The class that implements Behavior<RadGridView> is IsExpandableBehavior and the property that "commands" that behavior is IsExpandableSourcePropertyName - in this case it corresponds to the count of the elements in the child table. Its definition in xaml is:
<
i:Interaction.Behaviors
>
<
my:IsExpandableBehavior
IsExpandableSourcePropertyName
=
"Players.Count
/> </
i:Interaction.Behaviors
>
The other possible approach will be to set the binding during the RowLoaded event and to clear it during RowUnloaded event.
In this project the first approach is used, but still the code for the RowLoaded and RowUnloaded events is left so that you can see it.
The methods LoadPlayersAsync() and GetClubPlayers(Club club) are created only for testing the functionality with asynchronous loading of data - as it is you case.
Sincerely yours,
Maya
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.