This question is locked. New answers and comments are not allowed.
I have a parent child relationship where I want to control the column width for both the parent and child rows. I do not want headers, footers, and group panels. I am able to control these properties for the parent rows, but need help setting the child properties. I'm stuck, I don't know how to change the properties on the child rows to turn off headers, footers, and group panels.
I have a simple set of classes to fill in some sample data:
The attached output shows what I am getting.
| <telerik:RadGridView Name="ExerciseData" AutoGenerateColumns="False" ShowColumnHeaders="False" ShowGroupPanel="False" |
| FontFamily="Verdana" FontSize="9" Grid.Row="1"> |
| <telerik:RadGridView.Columns> |
| <telerik:GridViewDataColumn Header="" DataMemberBinding="{Binding Col0}" Width="100"/> |
| <telerik:GridViewDataColumn Header="" DataMemberBinding="{Binding Col1}" Width="30" /> |
| <telerik:GridViewDataColumn Header="" DataMemberBinding="{Binding Col2}" Width="30" /> |
| <telerik:GridViewDataColumn Header="" DataMemberBinding="{Binding Col3}" Width="30" /> |
| <telerik:GridViewDataColumn Header="" DataMemberBinding="{Binding Col4}" Width="30" /> |
| <telerik:GridViewDataColumn Header="" DataMemberBinding="{Binding Col5}" Width="30" /> |
| <telerik:GridViewDataColumn Header="" DataMemberBinding="{Binding Col6}" Width="30" /> |
| <telerik:GridViewDataColumn Header="" DataMemberBinding="{Binding Col7}" Width="30" /> |
| </telerik:RadGridView.Columns> |
| <telerik:RadGridView.ChildTableDefinitions> |
| <telerik:GridViewTableDefinition> |
| <telerik:GridViewTableDefinition.Relation> |
| <telerik:PropertyRelation ParentPropertyName="Aerobics" /> |
| </telerik:GridViewTableDefinition.Relation> |
| </telerik:GridViewTableDefinition> |
| <telerik:GridViewTableDefinition> |
| <telerik:GridViewTableDefinition.Relation> |
| <telerik:PropertyRelation ParentPropertyName="Anaerobics" /> |
| </telerik:GridViewTableDefinition.Relation> |
| </telerik:GridViewTableDefinition> |
| </telerik:RadGridView.ChildTableDefinitions> |
| </telerik:RadGridView> |
I have a simple set of classes to fill in some sample data:
| public MainPage() |
| { |
| InitializeComponent(); |
| //WeekHeaders.ItemsSource = WeekService.GetWeekHeaders(); |
| ExerciseData.ItemsSource = ExerciseService.GetExerciseData(); |
| } |
| } |
| public class Exercise |
| { |
| public string Col0 { get; set; } |
| public int Col1 { get; set; } |
| public int Col2 { get; set; } |
| public int Col3 { get; set; } |
| public int Col4 { get; set; } |
| public int Col5 { get; set; } |
| public int Col6 { get; set; } |
| public int Col7 { get; set; } |
| public List<ExerciseDetail> Aerobics { get; set; } |
| public List<ExerciseDetail> Anaerobics { get; set; } |
| } |
| public class ExerciseDetail |
| { |
| public string col0 { get; set; } |
| public int Col1 { get; set; } |
| public int Col2 { get; set; } |
| public int Col3 { get; set; } |
| public int Col4 { get; set; } |
| public int Col5 { get; set; } |
| public int Col6 { get; set; } |
| public int Col7 { get; set; } |
| } |
| public class ExerciseService |
| { |
| public static ObservableCollection<Exercise> GetExerciseData() |
| { |
| ObservableCollection<Exercise> exercises = new ObservableCollection<Exercise>(); |
| //Aerobic Totals |
| Exercise exercise = new Exercise(); |
| exercise.Col0 = "Aerobic Total"; |
| exercise.Col1 = 110; |
| exercise.Col2 = 125; |
| exercise.Col3 = 140; |
| exercise.Col4 = 80; |
| exercise.Col5 = 110; |
| exercise.Col6 = 125; |
| exercise.Col7 = 140; |
| //Aerobic Details |
| exercise.Aerobics = new List<ExerciseDetail>(); |
| ExerciseDetail ed1 = new ExerciseDetail(); |
| ed1.col0 = "eliptical"; |
| ed1.Col1 = 30; |
| ed1.Col2 = 45; |
| ed1.Col3 = 60; |
| ed1.Col4 = 0; |
| ed1.Col5 = 30; |
| ed1.Col6 = 45; |
| ed1.Col7 = 60; |
| exercise.Aerobics.Add(ed1); |
| ExerciseDetail ed2 = new ExerciseDetail(); |
| ed2.col0 = "walking"; |
| ed2.Col1 = 60; |
| ed2.Col2 = 60; |
| ed2.Col3 = 60; |
| ed2.Col4 = 60; |
| ed2.Col5 = 60; |
| ed2.Col6 = 60; |
| ed2.Col7 = 60; |
| exercise.Aerobics.Add(ed2); |
| ExerciseDetail ed3 = new ExerciseDetail(); |
| ed3.col0 = "running"; |
| ed3.Col1 = 20; |
| ed3.Col2 = 20; |
| ed3.Col3 = 20; |
| ed3.Col4 = 20; |
| ed3.Col5 = 20; |
| ed3.Col6 = 20; |
| ed3.Col7 = 20; |
| exercise.Aerobics.Add(ed3); |
| exercises.Add(exercise); |
| //Anaerobic Totals |
| exercise = new Exercise(); |
| exercise.Col0 = "Anaerobic Total"; |
| exercise.Col1 = 90; |
| exercise.Col2 = 105; |
| exercise.Col3 = 120; |
| exercise.Col4 = 0; |
| exercise.Col5 = 90; |
| exercise.Col6 = 105; |
| exercise.Col7 = 120; |
| //Anaerobic Details |
| exercise.Anaerobics = new List<ExerciseDetail>(); |
| ExerciseDetail ed4 = new ExerciseDetail(); |
| ed4.col0 = "sprints"; |
| ed4.Col1 = 30; |
| ed4.Col2 = 45; |
| ed4.Col3 = 60; |
| ed4.Col4 = 0; |
| ed4.Col5 = 30; |
| ed4.Col6 = 45; |
| ed4.Col7 = 60; |
| exercise.Anaerobics.Add(ed4); |
| ExerciseDetail ed5 = new ExerciseDetail(); |
| ed5.col0 = "weights"; |
| ed5.Col1 = 60; |
| ed5.Col2 = 60; |
| ed5.Col3 = 60; |
| ed5.Col4 = 60; |
| ed5.Col5 = 60; |
| ed5.Col6 = 60; |
| ed5.Col7 = 60; |
| exercise.Anaerobics.Add(ed5); |
| exercises.Add(exercise); |
| return exercises; |
| } |
| } |
The attached output shows what I am getting.