Hello I am trying to create a simple RadGridView based UserControl. I am getting all the data to display but cannot seem to get any attributes to set on the Child Grid. I've created a template grid for the child grid but it always seems to AutoGenerateColumns and ignore my column definitions along with any specific attributes at the Grid level.
Here is my Control w/ Grid:
Pretty simple right out of the example on the documentation.
Here is my Data objects I populate with mock data for testing:
I also attached a screen shot of what I am talking about in the application.
If you look at the XAML I have these important attributes I need in the Details Grid:
The user does not need to see the Grouping bar and also should be able to add new rows, almost identical to the parent Grid.
I'd appreciate any advice. Thanks!
Here is my Control w/ Grid:
<
UserControl
x:Class
=
"CCIGrid02.Views.WbsUserControl"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
xmlns:viewModels
=
"clr-namespace:MetaEstimatingProject.ViewModels;assembly=MetaEstimatingProject"
mc:Ignorable
=
"d"
d:DesignHeight
=
"480"
d:DesignWidth
=
"640"
>
<
Grid
>
<
Grid.Resources
>
<
viewModels:WbsViewModel
x:Key
=
"WbsViewModel"
/>
<
DataTemplate
x:Key
=
"RowDetailsTemplate"
>
<
telerik:RadGridView
Name
=
"valsgrid"
AutoGenerateColumns
=
"False"
CanUserDeleteRows
=
"True"
CanUserInsertRows
=
"True"
ShowInsertRow
=
"True"
ShowGroupPanel
=
"False"
Width
=
"640"
Height
=
"480"
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Code}"
Width
=
"100"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Description}"
Width
=
"250"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Notes}"
Width
=
"500"
/>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>
</
DataTemplate
>
</
Grid.Resources
>
<
telerik:RadGridView
x:Name
=
"gridView"
ItemsSource
=
"{Binding WbsKeys, Source={StaticResource WbsViewModel}}"
RowDetailsTemplate
=
"{StaticResource RowDetailsTemplate}"
AutoGenerateColumns
=
"False"
ShowInsertRow
=
"True"
ShowGroupPanel
=
"False"
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Key}"
Header
=
"Wbs Key"
UniqueName
=
"WbsKey"
MinWidth
=
"125"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Description}"
Header
=
"Description"
UniqueName
=
"WbsDesc"
MinWidth
=
"175"
/>
</
telerik:RadGridView.Columns
>
<
telerik:RadGridView.ChildTableDefinitions
>
<
telerik:GridViewTableDefinition
>
<
telerik:GridViewTableDefinition.Relation
>
<
telerik:PropertyRelation
ParentPropertyName
=
"Values"
/>
</
telerik:GridViewTableDefinition.Relation
>
</
telerik:GridViewTableDefinition
>
</
telerik:RadGridView.ChildTableDefinitions
>
</
telerik:RadGridView
>
</
Grid
>
</
UserControl
>
Pretty simple right out of the example on the documentation.
Here is my Data objects I populate with mock data for testing:
public
class
WbsKey {
#region C'tors
public
WbsKey() {
Key =
"EmptyKey"
;
Description =
"Empty Desc"
;
Values =
new
List<WbsValue>();
}
public
WbsKey(
string
key)
{
Key = key;
Description =
"Empty Desc"
;
Values =
new
List<WbsValue>();
}
public
WbsKey(
string
key,
string
description) {
Key = key ??
"EmptyKey"
;
Description = description ??
"Empty Desc"
;
Values =
new
List<WbsValue>();
}
public
WbsKey(
string
key, List<WbsValue> values) {
Key = key ??
"EmptyKey"
;
Values = values ??
new
List<WbsValue>();
}
#endregion
#region Instance Properties
public
string
Key {
get
;
set
; }
public
string
Description {
get
;
set
; }
public
List<WbsValue> Values {
get
;
set
; }
#endregion
}
public
class
WbsValue {
#region C'tors
public
WbsValue() {
}
public
WbsValue(
string
code,
string
description) {
Code = code;
Description = description;
}
public
WbsValue(
string
code,
string
description,
string
notes) {
Code = code;
Description = description;
Notes = notes;
}
#endregion
#region Instance Properties
public
string
Code {
get
;
set
; }
public
string
Description {
get
;
set
; }
public
string
Notes {
get
;
set
; }
#endregion
}
I also attached a screen shot of what I am talking about in the application.
If you look at the XAML I have these important attributes I need in the Details Grid:
<
DataTemplate
x:Key
=
"RowDetailsTemplate"
>
<
telerik:RadGridView
Name
=
"valsgrid"
AutoGenerateColumns
=
"False"
CanUserDeleteRows
=
"True"
CanUserInsertRows
=
"True"
ShowInsertRow
=
"True"
ShowGroupPanel
=
"False"
Width
=
"640"
Height
=
"480"
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Code}"
Width
=
"100"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Description}"
Width
=
"250"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Notes}"
Width
=
"500"
/>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>
</
DataTemplate
>
The user does not need to see the Grouping bar and also should be able to add new rows, almost identical to the parent Grid.
I'd appreciate any advice. Thanks!