
Mike Inman
Top achievements
Rank 1
Mike Inman
asked on 19 Sep 2008, 06:01 PM
I created a Windows WPF project and am using the RadGridView that has a child table using a TableRelation. I want to be able to hide the expand/collapse image if there are no child records. I saw an example or two that were similar to what I wanted, but populate the grid by adding records within a loop. I am assigning the ItemSource of the grid and DataSource of the GridViewTableDefinition and haven't been able to find an example of what I want that populates the grid in this way. I tried using the "PreviewDataRecordCreate" event, but it doesn't seem to fire when assigning the ItemSource. I would really like to avoid adding records by looping through the data. I looked through the API and didn't see anything obvious, but will continue to look. Have I just overlooked something or is there not a simple way to do this? Thanks.
8 Answers, 1 is accepted
0
Hi Mike Inman,
There is no straightforward way to achieve this. However, there is a workaround. I can prepare for you a sample template for the expander in hierarchy rows. The visibility of the toggle button can be bound to the count of the slave table children via ValueConverter.
Can you please tell me which theme you are using ( may be the default one ? ) , so that I can tweak the template for you and provide a sample ?
All the best,
Pavel Pavlov
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
There is no straightforward way to achieve this. However, there is a workaround. I can prepare for you a sample template for the expander in hierarchy rows. The visibility of the toggle button can be bound to the count of the slave table children via ValueConverter.
Can you please tell me which theme you are using ( may be the default one ? ) , so that I can tweak the template for you and provide a sample ?
All the best,
Pavel Pavlov
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0

Mike Inman
Top achievements
Rank 1
answered on 23 Sep 2008, 04:26 PM
I am currently using the Caramel theme.
0
Hi Mike Inman,
Currently the only way to hide the expander button is to modify the style for our HierarchyChildPresenter and supply new template for the Expander that the presenter uses. Since there is a lot of XAML involved I've created a sample application that demonstrates how to do it. The sample application resembles our example on custom hierarchy, where records 3 and 5 have a child table definitions defined. The difference is that record 3 now does not have any children and the expander button is not displayed.
In order to incorporate the changes into your solution you should simply copy the new style for HierarchyChildPresenter, the template for Exapner, and the ExpanderButtonVisibilityConverter class.
Sincerely yours,
Milan
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Currently the only way to hide the expander button is to modify the style for our HierarchyChildPresenter and supply new template for the Expander that the presenter uses. Since there is a lot of XAML involved I've created a sample application that demonstrates how to do it. The sample application resembles our example on custom hierarchy, where records 3 and 5 have a child table definitions defined. The difference is that record 3 now does not have any children and the expander button is not displayed.
In order to incorporate the changes into your solution you should simply copy the new style for HierarchyChildPresenter, the template for Exapner, and the ExpanderButtonVisibilityConverter class.
Sincerely yours,
Milan
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0

Mike Inman
Top achievements
Rank 1
answered on 29 Sep 2008, 10:03 PM
Thank you for putting the example together. I have been working on other parts of the project, but I hope to look into the example this week.
0
Hello Mike Inman,
I hope that the example demonstrated the exact functionality you required.
Please fee free to write back to us if you have any problems with the sample application.
All the best,
Milan
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
I hope that the example demonstrated the exact functionality you required.
Please fee free to write back to us if you have any problems with the sample application.
All the best,
Milan
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0

Erez
Top achievements
Rank 1
answered on 08 Aug 2009, 10:21 AM
Hello,
Does the wpf 2009q2 support this feature out of the box (hiding the plus sign when there are no child records) ?
If not, are you planning on doing so in the 2009q3 release ?
Thanks,
Erez
0
Hi Erez,
You can specify explicitly which record will have child data:
http://demos.telerik.com/wpf/?GridView/WPF/Hierarchy/CustomHierarchy
Regards,
Vlad
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
You can specify explicitly which record will have child data:
http://demos.telerik.com/wpf/?GridView/WPF/Hierarchy/CustomHierarchy
Regards,
Vlad
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0

Daryl
Top achievements
Rank 1
answered on 24 May 2011, 09:02 PM
In the examples, you show how to hide an indicator assuming the parent row has some sort of indicator that the child record is going to be null. In the example you check to see if the Order Id is null in the parent record and if it is then the indicator is turned off.
What if you have no such indicator in the parent, or if in your case there is an order id that is valid (say Order id 1000) but no child record exists for that Order Id?
Do you have some way of dealing with that?
Thanks,
Daryl
What if you have no such indicator in the parent, or if in your case there is an order id that is valid (say Order id 1000) but no child record exists for that Order Id?
Do you have some way of dealing with that?
Thanks,
Daryl