<sync:SfDataGrid x:Name="DgChasClaims"
Grid.Row="2"
Margin="15,10"
AllowDraggingColumns="False"
AutoExpandGroups="True"
AutoGenerateColumns="False"
AllowResizingColumns="True"
GridValidationMode="InEdit"
HeaderRowHeight="35"
ColumnSizer="Star"
AllowEditing="True"
CurrentCellBorderThickness="0"
ItemsSource="{Binding Model.ClaimList}"
NavigationMode="Cell"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Auto"
SelectionMode="Single"
ShowColumnWhenGrouped="False"
ShowGroupDropArea="False"
ShowRowHeader="False"
EditTrigger="OnTap"
KeyDown="DgChasClaims_KeyDown"
RowStyle="{DynamicResource RowStyle}"
AlternatingRowStyle="{DynamicResource AlternatingRowStyle}"
AlternationCount="2">
<sync:SfDataGrid.Resources>
<Style TargetType="sync:HeaderRowControl">
<Setter Property="Background" Value="#ffffff"/>
<Setter Property="BorderThickness" Value="0,0,0,2"/>
<Setter Property="BorderBrush" Value="#3fa0e0"/>
</Style>
<Style TargetType="sync:VirtualizingCellsControl" x:Key="AlternatingRowStyle">
<Setter Property="Background" Value="{DynamicResource GridAlternateBGBrush}" />
</Style>
<Style TargetType="sync:VirtualizingCellsControl" x:Key="RowStyle">
<Setter Property="Background" Value="White"/>
</Style>
<Style TargetType="sync:GridStackedHeaderCellControl">
<Setter Property="FontFamily" Value="Source Sans Pro" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="FontSize" Value="14" />
<Setter Property="Padding" Value="0" />
<Setter Property="Foreground" Value="{DynamicResource ButtonDarkBlueBGBrush}" />
<Setter Property="BorderThickness" Value="0,0,1,0" />
<Setter Property="Margin" Value="0,0,-1,0"/>
</Style>
<Style TargetType="sync:GridCell">
<Setter Property="BorderBrush" Value="{DynamicResource GridBorderBGBrush}" />
<Setter Property="Padding" Value="4,0" />
<Style.Triggers>
<DataTrigger Binding="{Binding Path=IsConcurrencyConflict}" Value="true">
<Setter Property="Foreground" Value="Red" />
</DataTrigger>
</Style.Triggers>
</Style>
<Style TargetType="sync:GridHeaderCellControl">
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="FontFamily" Value="Source Sans Pro" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="Foreground" Value="#2d2d2d"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Margin" Value="4,3,0,0"/>
<Setter Property="Padding" Value="0"/>
</Style>
</sync:SfDataGrid.Resources>
<sync:SfDataGrid.StackedHeaderRows>
<sync:StackedHeaderRow>
<sync:StackedHeaderRow.StackedColumns>
<sync:StackedColumn HeaderText="Invoice Details" ChildColumns="VisitDate,PatientName,InvoiceNo,InvoiceAmt"/>
<sync:StackedColumn HeaderText="Claim Details" ChildColumns="ClaimAmt,ApprovedAmt"/>
<sync:StackedColumn HeaderText="Payment Collection Details" ChildColumns="OutstandingAmt,VPaymentAmount,"/>
</sync:StackedHeaderRow.StackedColumns>
</sync:StackedHeaderRow>
</sync:SfDataGrid.StackedHeaderRows>
|
this.textBox.LostFocus += TextBox_LostFocus;
private void TextBox_LostFocus(object sender, RoutedEventArgs e)
{
if (this.dataGrid.Columns[4].MappingName == "OrderID")
{
this.dataGrid.MoveCurrentCell(new RowColumnIndex(2, 4));
this.dataGrid.SelectionController.CurrentCellManager.BeginEdit();
}
} |
|
this.dataGrid.SelectionController = new CustomSelectionController(dataGrid);
public class CustomSelectionController : GridSelectionController
{
public CustomSelectionController(SfDataGrid dataGrid)
: base(dataGrid)
{
}
protected override void ProcessKeyDown(KeyEventArgs args)
{
// Get the CurrentCell column index
var currentColumnIndex = this.CurrentCellManager.CurrentRowColumnIndex.ColumnIndex;
// Get last column index of the SfDataGrid through the SelectionHelper
var lastIndex = SelectionHelper.GetLastColumnIndex(DataGrid);
base.ProcessKeyDown(args);
if (args.Key == Key.Tab && this.DataGrid.Columns[currentColumnIndex].MappingName== "OrderID")
{
var rowIndex = this.CurrentCellManager.CurrentRowColumnIndex.RowIndex;
this.MoveCurrentCell(new RowColumnIndex(rowIndex, 4));
this.DataGrid.ScrollInView(this.CurrentCellManager.CurrentRowColumnIndex);
this.CurrentCellManager.BeginEdit();
}
}
} |