Hi... I am using xamdatagrid in which there is a problem in selection.I will retrieve all fields from database and i changing order of the fields using up and down button.When i send the field up or down and field which i have sent up will be selected same as selected background brush and i selection will remain as it is.It will be bit confusing.I am sending xaml code which is below.
<igDP:XamDataGrid Name="RoleDataGrid" DataSource="{Binding SortedItems}" UpdateMode="OnRecordChange" AutoFit="True" ActiveDataItem="{Binding SelectedChecklistItem,Mode=TwoWay}" Grid.Row="3" Grid.ColumnSpan="2" MaxHeight="400" ScrollViewer.CanContentScroll="True" GroupByAreaLocation="None" ScrollingMode="DeferredWithScrollTips" Theme="[Current]" ScrollViewer.VerticalScrollBarVisibility="Visible" Sorting="RoleDataGrid_Sorting">
<igDP:XamDataGrid.Resources>
<Style TargetType="{x:Type igDP:CellValuePresenter}" x:Key="checkboxstyles">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}">
<Editors:XamCheckEditor Name="Rolecombox" IsChecked="{Binding DataItem.IsMandatory, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Center" VerticalAlignment="Center" VerticalContentAlignment="Center">
</Editors:XamCheckEditor>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</igDP:XamDataGrid.Resources>
<igDP:XamDataGrid.FieldLayoutSettings>
<igDP:FieldLayoutSettings MaxSelectedCells="0" SelectionTypeRecord="Single" SelectionTypeCell="None" MaxSelectedRecords="1" AutoGenerateFields="False" AllowFieldMoving="No" HighlightAlternateRecords="False" SelectionTypeField="Single" FilterUIType="LabelIcons" HeaderPrefixAreaDisplayMode="FieldChooserButton" />
</igDP:XamDataGrid.FieldLayoutSettings>
<igDP:XamDataGrid.FieldSettings>
<igDP:FieldSettings AllowRecordFiltering="True" CellClickAction="SelectRecord" FilterLabelIconDropDownType="MultiSelectExcelStyle" SortComparisonType="CaseSensitive" FilterClearButtonVisibility="{x:Null}" AllowCellVirtualization="True" />
</igDP:XamDataGrid.FieldSettings>
<igDP:XamDataGrid.FieldLayouts>
<igDP:FieldLayout>
<igDP:FieldLayout.Fields>
<igDP:Field Name="Name" Label="Name" Width="200">
<igDP:Field.Settings>
<igDP:FieldSettings AllowEdit="False" />
</igDP:Field.Settings>
</igDP:Field>
<igDP:Field Name="Description" Label="Description" Width="200">
<igDP:UnboundField Label="Mandatory" Width="200">
<igDP:UnboundField.Settings>
<igDP:FieldSettings AllowEdit="False" CellValuePresenterStyle="{StaticResource checkboxstyles}" />
</igDP:UnboundField.Settings>
</igDP:UnboundField>
</igDP:FieldLayout.Fields>
</igDP:FieldLayout>
</igDP:XamDataGrid.FieldLayouts>
</igDP:XamDataGrid>
And also i sending screen shot of theproblem xamdatagrid.Plz verify it.
Hello shankarnag,
Thank you for the snippets, still based on them I am not sure which is the exact approach that you use to reorder the records. Would you please provide me with some additional information how do you implement your Swap method.
Thanks in advance.
I am writing Icommand for up and down button.
public ICommand MoveItemUpCommand
{
get
return new RelayCommand(
() => SwapItems(SelectedChecklistItem, PreviousItem),
() => PreviousItem != null && DocuManService.Services.User.HasRight(DocumanCommand.EditChecklist));
}
/// <summary>Gets MoveItemUpCommand.</summary>
public ICommand MoveItemDownCommand
() => SwapItems(NextItem, SelectedChecklistItem),
() => SelectedChecklistItem != null && NextItem != null && DocuManService.Services.User.HasRight(DocumanCommand.EditChecklist));
Plz verify and help me.
I have been looking into your question still I am not sure that I understood your scenario correctly. Would you please provide me with the code where you move the record up or down with your buttons, so I can be sure that we are looking into the same behavior.