Hopefully this is a quick one. I have a hierarchical grid view and when I expand the child grid there is a border/padding around it of about 5 pixels. How do I set this to 0 so there is no space around the child grid ?
Thanks,
Richard
6 Answers, 1 is accepted
You can easily achieve this effect through editing the template of GridViewRow, find HierarchyChildPresenter and set the Padding property of the Border that holds it to 0. If you want to read more about styles and templates I would suggest you to see the following article Styling a Row. Attached is a sample project that illustrates this approach.
If you need any further assistance please let me know.
Greetings,
Vanya Pavlova
the Telerik team
Richard
Seems straight forward enough, edit the alternating row template to include the padding = 0 as well but it does not work.
Blend will not let me create a RowStyle and AltRowStyle copy of the templates because of a "Resource Key Conflict" .
So my question is , using the HierarchyChildPresenter's Padding = 0 how can I make this work with alternating row styles ??
Thanks,
Richard
If you want to remove the Padding in these styles you should have 2 separate templates-one for the ordinary GridViewRowStyle and the second one for AlternateRowStyle. Both are targeted at GridViewRow.
Indeed you may get a resource conflicts if these styles are in a common ResourceCollection, so you may do the following:
1. Add two separate ResourceDictionaries to your project - ResourceDictionary1, ResourceDictionary2.
2. In ResourceDictionary1 copy the template from my previous reply and name it GridViewRowStyle1.
3. In ResourceDictionary2 copy the template from my previous reply and name it AlternateRowStyle1.
Set these styles to RadGridView and you will remove the Padding in a Hierarchical RadGridView in both cases.
Please give it a try and let me know how it goes!
Vanya Pavlova
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>
This Padding is hard-coded within the template of GridViewRow. You may remove it only through editing the template of this element. Keep in mind that styles in Telerik themes are theme specific. If you want to set an AlternateRowStyle (or any other style such as CellStyle, HeaderCellStyle etc.) to child tables you may mark the style as BasedOn the particular theme:
<
UserControl.Resources
>
<
Style
x:Key
=
"s1"
TargetType
=
"telerik:GridViewRow"
telerik:StyleManager.BasedOn
=
"Vista"
>
<
Setter
Property
=
"Foreground"
Value
=
"Red"
/>
........
</
Style
>
</
UserControl.Resources
>
<
Grid
x:Name
=
"LayoutRoot"
Background
=
"White"
>
</
Grid
>
</
UserControl
>
Then when you set Vista theme the style above will be handled correspondingly.
You may use the same technique for any RadControl if you need to make some changes based on a theme different than the default one.
Kind regards,
Vanya Pavlova
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>