Hi,
I have a hierarchical grid of Tasks. Each parent row (task) has the possibility of having 0-* child rows (tasks). The depth of the grid is indefinite.
Currently the grid SelectionMode is set to single but the grid allows the selection of one parent and one child at a time. I want to restrict the user to only be able to select a single task at a time ( regardless of whether it's a parent or a child task). - refer to the attached image.
I'm adding the child table definitions on the Xaml file. This is the code snippet:
And I'm defining the child grid on the dataloading event:
Looking for a reasonable solution.
Kindest Regards,
Abdul
I have a hierarchical grid of Tasks. Each parent row (task) has the possibility of having 0-* child rows (tasks). The depth of the grid is indefinite.
Currently the grid SelectionMode is set to single but the grid allows the selection of one parent and one child at a time. I want to restrict the user to only be able to select a single task at a time ( regardless of whether it's a parent or a child task). - refer to the attached image.
I'm adding the child table definitions on the Xaml file. This is the code snippet:
<
telerik:RadGridView.ChildTableDefinitions
>
<
telerik:GridViewTableDefinition
>
<
telerik:GridViewTableDefinition.Relation
>
<
telerik:TableRelation
IsSelfReference
=
"True"
>
<
telerik:TableRelation.FieldNames
>
<
telerik:FieldDescriptorNamePair
ParentFieldDescriptorName="TaskId"
ChildFieldDescriptorName="ParentTaskId"/>
</
telerik:TableRelation.FieldNames
>
</
telerik:TableRelation
>
</
telerik:GridViewTableDefinition.Relation
>
</
telerik:GridViewTableDefinition
>
</
telerik:RadGridView.ChildTableDefinitions
>
And I'm defining the child grid on the dataloading event:
private
void
ProjectTasksGridView_DataLoading(
object
sender, GridViewDataLoadingEventArgs e)
{
GridViewDataControl dataControl = (GridViewDataControl)sender;
if
(dataControl.ParentRow !=
null
)
{
dataControl.GridLinesVisibility = GridLinesVisibility.Vertical;
dataControl.IsFilteringAllowed =
false
;
dataControl.ShowGroupPanel =
false
;
dataControl.SelectionMode = System.Windows.Controls.SelectionMode.Single;
dataControl.AutoGenerateColumns =
false
;
dataControl.CanUserFreezeColumns =
false
;
dataControl.IsReadOnly =
true
;
dataControl.RowLoaded +=
new
EventHandler<RowLoadedEventArgs>(ProjectTasksGridView_RowLoaded);
dataControl.SelectionChanged +=
this
.ProjectTasksGridView_SelectionChanged;
GridViewDataColumn column =
new
GridViewDataColumn();
column.DataMemberBinding =
new
Binding(
"WbsId"
);
column.Header =
"WBS"
;
dataControl.Columns.Add(column);
column =
new
GridViewDataColumn();
column.DataMemberBinding =
new
Binding(
"TaskName"
);
.
.
.
}
Looking for a reasonable solution.
Kindest Regards,
Abdul