This question is locked. New answers and comments are not allowed.
Hi,
I'm having a problem databinding within a GridViewDataColumn Template. Here is the situation.
I have an Employee Class which has a list of SheduleActivities. This activity is like an appointment in outlook (startdate, endate, ...)
To display the activities of an Employee in the grid I made a SheduleWeek class, which has the properties Monday, Tuesday,..
of the type SheduleActivity. I first get the needed employees, create the SheduleWeeks with the employees and use the list of SheduleWeek as my ItemsSource.
| var itemsSource = employees.Select(o => new SheduleWeek(o)).ToList(); |
| planningGrd.ItemsSource = itemsSource; |
As my columnTemplate I use the following code
| <Controls:GridViewDataColumn Header="Maandag"> |
| <Controls:GridViewDataColumn.CellStyle> |
| <Style TargetType="telerikGridView:GridViewCell"> |
| <Setter Property="Template"> |
| <Setter.Value> |
| <ControlTemplate TargetType="telerikGridView:GridViewCell"> |
| <Grid> |
| <TextBlock x:Name="activityTxt" Text="{Binding}" TextWrapping="Wrap" FontWeight="Bold" /> |
| <GridItems:ActivityDetails DataContext="{Binding Monday}" Test="{Binding}" /> |
| </Grid> |
| </ControlTemplate> |
| </Setter.Value> |
| </Setter> |
| <Setter Property="BorderThickness" Value="0,0,1,1"/> |
| </Style> |
| </Controls:GridViewDataColumn.CellStyle> |
| </Controls:GridViewDataColumn> |
The activityTxt I used just to check out which type I was binding to. When runnning the project it gives me the "SheduleWeek" type just like I expected. To display all the information I made a Usercontrol ActivityDetails. On this control I created a dependency property "Test" of the type string to check the type. And this string tells me the type I bind to is "SheduleActivity".
When I actualy want the SheduleWeek over there.
Can somebody explain to me why this happens and how to solve this?
Thanks in advance