Hello,
Just updated my controls to 2010.1.402.1. We were going off of the GridView/Hierarchy/CustomHierarchy example. in the DataLoading method if we set ShowColumnFooters = true then none of the columns are displayed. We did try it with a DataTemplate in xaml instead and that seemed to work just fine. Any ideas on how to display the column footers without setting it all up in xaml?
Thanks Much,
~Boots
Just updated my controls to 2010.1.402.1. We were going off of the GridView/Hierarchy/CustomHierarchy example. in the DataLoading method if we set ShowColumnFooters = true then none of the columns are displayed. We did try it with a DataTemplate in xaml instead and that seemed to work just fine. Any ideas on how to display the column footers without setting it all up in xaml?
<Window |
x:Class="RadGridViewTest.Window1" |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" |
xmlns:local="clr-namespace:RadGridViewTest" |
Title="Window1"> |
<Grid> |
<telerik:RadGridView |
x:Name="rgv" |
AutoGenerateColumns="False" DataLoading="RadGridView_DataLoading"> |
<telerik:RadGridView.Columns> |
<telerik:GridViewDataColumn UniqueName="Column1" Header="Column 1" /> |
<telerik:GridViewDataColumn UniqueName="Column2" Header="Column 2" /> |
</telerik:RadGridView.Columns> |
</telerik:RadGridView> |
</Grid> |
</Window> |
using System; |
using System.Collections.Generic; |
using System.Linq; |
using System.Text; |
using System.Windows; |
using System.Windows.Controls; |
using System.Windows.Data; |
using System.Windows.Documents; |
using System.Windows.Input; |
using System.Windows.Media; |
using System.Windows.Media.Imaging; |
using System.Windows.Navigation; |
using System.Windows.Shapes; |
using System.Collections; |
using System.Collections.ObjectModel; |
using Telerik.Windows.Controls.GridView; |
using Telerik.Windows.Data; |
using Telerik.Windows.Controls; |
namespace RadGridViewTest |
{ |
/// <summary> |
/// Interaction logic for Window1.xaml |
/// </summary> |
public partial class Window1 : Window |
{ |
public Window1() |
{ |
InitializeComponent(); |
ObservableCollection<Column> Columns = new ObservableCollection<Column>(); |
ObservableCollection<ChildGridColumn> ChildGridColumns = new ObservableCollection<ChildGridColumn>(); |
for (int i = 0; i < 100; i++) |
ChildGridColumns.Add(new ChildGridColumn(i)); |
for (int i = 0; i < 100; i++) |
Columns.Add(new Column(i, i, ChildGridColumns)); |
this.rgv.ItemsSource = Columns; |
GridViewTableDefinition gvtd = new GridViewTableDefinition(); |
gvtd.Relation = new PropertyRelation("ChildGridColumns"); |
this.rgv.ChildTableDefinitions.Add(gvtd); |
} |
private void RadGridView_DataLoading(object sender, Telerik.Windows.Controls.GridView.GridViewDataLoadingEventArgs e) |
{ |
GridViewDataControl dataControl = (GridViewDataControl)sender; |
if (dataControl.ParentRow != null) |
{ |
dataControl.ShowColumnFooters = true; |
dataControl.AutoGenerateColumns = false; |
dataControl.Columns.Add(new Telerik.Windows.Controls.GridViewDataColumn() |
{ |
UniqueName = "ChildColumn1", |
Header = "Column 1" |
}); |
dataControl.Columns.Add(new Telerik.Windows.Controls.GridViewDataColumn() |
{ |
UniqueName = "ChildColumn2", |
Header = "Column 2" |
}); |
dataControl.Columns.Add(new Telerik.Windows.Controls.GridViewDataColumn() |
{ |
UniqueName = "ChildColumn3", |
Header = "Column 3" |
}); |
} |
} |
} |
public class Column |
{ |
public Column(int Column1, int Column2, ObservableCollection<ChildGridColumn> ChildGridColumns) |
{ |
this.Column1 = Column1; |
this.Column2 = Column2; |
this.ChildGridColumns = ChildGridColumns; |
} |
public int Column1 { get; set; } |
public int Column2 { get; set; } |
public ObservableCollection<ChildGridColumn> ChildGridColumns { get; set; } |
} |
public class ChildGridColumn |
{ |
public ChildGridColumn(int Num) |
{ |
this.ChildColumn1 = Num; |
this.ChildColumn2 = Num; |
this.ChildColumn3 = Num; |
} |
public int ChildColumn1 { get; set; } |
public int ChildColumn2 { get; set; } |
public int ChildColumn3 { get; set; } |
} |
} |
Thanks Much,
~Boots