Hi!
I need to implementation auto start begin edit cell in the same row and next column, after click in previous column.
In begin my table, code works correctly. But in the last row and in penultimate column code doesn't work correctly, it begin start edit in the last row and in third column.
But after how I write value by myself, code start to work correctly. I use telerik framework.
Thank you for your responses!
var element = sender
as
FrameworkElement;
ConditionsRadGridView.CommitEdit();
var parentCell = element.GetVisualParent<GridViewCell>();
if
(parentCell !=
null
)
{
var index = ConditionsRadGridView.Columns.IndexOf(parentCell.Column);
if
(index != -1 && index < parentCell.ParentRow.Cells.Count)
{
var nextCell = parentCell.ParentRow.Cells[index]
as
GridViewCell;
if
(nextCell !=
null
)
{
ConditionsRadGridView.CurrentCellInfo =
new
GridViewCellInfo(nextCell);
ConditionsRadGridView.BeginEdit();
}
}
}
<
telerik:RadGridView
ValidatesOnDataErrors
=
"InViewMode"
Name
=
"ConditionsRadGridView"
Grid.Row
=
"1"
Grid.Column
=
"0"
Grid.ColumnSpan
=
"2"
Margin
=
"6 3 6 6"
HorizontalAlignment
=
"Left"
RowIndicatorVisibility
=
"Collapsed"
AutoGenerateColumns
=
"False"
CanUserDeleteRows
=
"False"
CanUserInsertRows
=
"False"
ShowGroupPanel
=
"False"
CanUserReorderColumns
=
"False"
FrozenColumnCount
=
"1"
CanUserFreezeColumns
=
"False"
ItemsSource
=
"{Binding Conditions}"
EnableColumnVirtualization
=
"False"
RowStyle
=
"{StaticResource ValidationFixStyle}"
SelectionMode
=
"Extended"
cal:Message.Attach
=
"[Event PreviewKeyUp] = [Action ConditionsKeyUp($this.SelectedItems, $eventArgs)]"
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
CellStyle
=
"{StaticResource SelectedCellStyle}"
Header
=
"{x:Static properties:Resources.Station}"
DataMemberBinding
=
"{Binding Name, Mode=TwoWay}"
CellTemplateSelector
=
"{StaticResource ConditionNameTemplateSelector}"
/>
<
telerik:GridViewColumn
IsVisible
=
"{Binding IsHaveGroups}"
>
<
telerik:GridViewColumn.CellTemplate
>
<
DataTemplate
>
<
CheckBox
Visibility
=
"{Binding IsGroup, Converter={StaticResource BoolToVisibilityConverter}}"
IsChecked
=
"{Binding IsSplitUp, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
cal:Message.Attach
=
"[Event Click] = [Action IsSplitUpClick($datacontext)]"
/>
</
DataTemplate
>
</
telerik:GridViewColumn.CellTemplate
>
</
telerik:GridViewColumn
>
<
telerik:GridViewDataColumn
Header
=
"{x:Static properties:Resources.AffinityOperator}"
ColumnGroupName
=
"Affinity"
DataMemberBinding
=
"{Binding AffinityOperator, UpdateSourceTrigger=PropertyChanged}"
TextAlignment
=
"Center"
IsReadOnly
=
"True"
>
<
telerik:GridViewDataColumn.CellTemplate
>
<
DataTemplate
DataType
=
"{x:Type vm:StationConditionViewModel}"
>
<
Grid
HorizontalAlignment
=
"Stretch"
VerticalAlignment
=
"Stretch"
>
<
controls3:RadComboBox
IsEnabled
=
"{Binding IsRowEnabled}"
SelectionChanged
=
"StartEditNextCell"
SelectedItem
=
"{Binding AffinityOperator, UpdateSourceTrigger=PropertyChanged}"
ItemsSource
=
"{Binding Operators}"
VerticalAlignment
=
"Center"
HorizontalAlignment
=
"Stretch"
/>
</
Grid
>
</
DataTemplate
>
</
telerik:GridViewDataColumn.CellTemplate
>
</
telerik:GridViewDataColumn
>
<
telerik:GridViewDataColumn
Header
=
"{x:Static properties:Resources.AffinityValue}"
ColumnGroupName
=
"Affinity"
IsReadOnlyBinding
=
"{Binding AffinityIsReadOnly}"
DataMemberBinding
=
"{Binding Path=AffinityValue}"
TextAlignment
=
"Right"
>
<
telerik:GridViewDataColumn.CellTemplate
>
<
DataTemplate
DataType
=
"{x:Type vm:StationConditionViewModel}"
>
<
TextBlock
Text
=
"{Binding AffinityValue, StringFormat={}{0:N2}}"
Visibility
=
"{Binding AffinityVisibility}"
VerticalAlignment
=
"Center"
HorizontalAlignment
=
"Right"
/>
</
DataTemplate
>
</
telerik:GridViewDataColumn.CellTemplate
>
</
telerik:GridViewDataColumn
>