This question is locked. New answers and comments are not allowed.
Hi,
I have three columns in a RadGridView that are of the same type (Resource) that should use the same DataTemplate. Initially I had the DataTemplate in the Grid.Resources section but could not get the DataBinding to work. Afterwards I used an elaborate way by specifing the template repeatedly and binding each under the RadGridView.Columns. This works but is obviously not the preferred way nor the elegant way to do this:
How do I create a single template and bind to the planned-, rostered- and actual resources?
I have three columns in a RadGridView that are of the same type (Resource) that should use the same DataTemplate. Initially I had the DataTemplate in the Grid.Resources section but could not get the DataBinding to work. Afterwards I used an elaborate way by specifing the template repeatedly and binding each under the RadGridView.Columns. This works but is obviously not the preferred way nor the elegant way to do this:
<radControls:RadGridView x:Name="registerGridView" |
AutoGenerateColumns="False"> |
<radControls:RadGridView.Columns> |
<radControls:GridViewToggleRowDetailsColumn /> |
<radControls:GridViewDataColumn Header="Client" /> |
<radControls:GridViewDataColumn Header="Site" /> |
<radControls:GridViewDataColumn Header="Post" /> |
<radControls:GridViewDataColumn Header="Planned"> |
<radControls:GridViewDataColumn.CellTemplate> |
<DataTemplate> |
<StackPanel Orientation="Horizontal"> |
<TextBlock Text="{Binding PlannedResource.Firstname}" |
Margin="2" /> |
<TextBlock Text="{Binding PlannedResource.Lastname}" |
Margin="2" /> |
</StackPanel> |
</DataTemplate> |
</radControls:GridViewDataColumn.CellTemplate> |
</radControls:GridViewDataColumn> |
<radControls:GridViewDataColumn Header="Rostered"> |
<radControls:GridViewDataColumn.CellTemplate> |
<DataTemplate> |
<StackPanel Orientation="Horizontal"> |
<TextBlock Text="{Binding RosteredResource.Firstname}" |
Margin="2" /> |
<TextBlock Text="{Binding RosteredResource.Lastname}" |
Margin="2" /> |
</StackPanel> |
</DataTemplate> |
</radControls:GridViewDataColumn.CellTemplate> |
</radControls:GridViewDataColumn> |
<radControls:GridViewDataColumn Header="Actual"> |
<radControls:GridViewDataColumn.CellTemplate> |
<DataTemplate> |
<StackPanel Orientation="Horizontal"> |
<TextBlock Text="{Binding ActualResource.Firstname}" |
Margin="2" /> |
<TextBlock Text="{Binding ActualResource.Lastname}" |
Margin="2" /> |
</StackPanel> |
</DataTemplate> |
</radControls:GridViewDataColumn.CellTemplate> |
</radControls:GridViewDataColumn> |
</radControls:RadGridView.Columns> |
</radControls:RadGridView> |
How do I create a single template and bind to the planned-, rostered- and actual resources?