hi,
i have a xamdata grid as follows
<igDP:XamDataGrid Height="auto" Grid.Row="0" BorderThickness="1,1,1,1" Margin="30,10,30,10" BorderBrush="LightGray" ScrollingMode="Deferred" DataSource="{Binding Model.ProjectReferences}" ActiveDataItem="{Binding Model.SelectedProjectReference,UpdateSourceTrigger=PropertyChanged}" FlowDirection="LeftToRight" GroupByAreaLocation="None" HorizontalAlignment="Stretch" > <igDP:XamDataGrid.Resources> <Style TargetType="{x:Type igDP:CellValuePresenter}"> <EventSetter Event="PreviewMouseLeftButtonDown" Handler="CellValuePresenter_PreviewMouseLeftButtonDown"/> </Style> </igDP:XamDataGrid.Resources>
<igDP:XamDataGrid.FieldLayoutSettings > <igDP:FieldLayoutSettings AllowDelete="False" DataRecordCellAreaStyle="{DynamicResource PCETReadOnlyDataRecordCellArea}" SelectionTypeRecord="Single" AutoGenerateFields="False" HighlightAlternateRecords="True" RecordSelectorLocation="None" AllowFieldMoving="No" RecordSelectorStyle="{DynamicResource PCET_XamDataGrid_RecordSelector}" ></igDP:FieldLayoutSettings> </igDP:XamDataGrid.FieldLayoutSettings> <igDP:XamDataGrid.FieldSettings > <igDP:FieldSettings LabelTextAlignment="Left" AllowEdit="True" CellClickAction="SelectRecord" AutoSizeOptions="All" Width="Auto" AutoSizeScope="AllRecords"/> </igDP:XamDataGrid.FieldSettings>
<igDP:XamDataGrid.FieldLayouts > <igDP:FieldLayout> <igDP:FieldLayout.Fields >
<igDP:UnboundField BindingPath="SerialNumber" Label="{tp:Localize serialNo}" Visibility="Visible" Width="*"> <igDP:UnboundField.Settings> <igDP:FieldSettings LabelPresenterStyle="{StaticResource LabelPresenterStyle}" > </igDP:FieldSettings> </igDP:UnboundField.Settings> </igDP:UnboundField>
<igDP:UnboundField IsScrollTipField="False" BindingPath="CustomerName" Label="{tp:Localize customerName}" Visibility="Visible" Width="*"> <igDP:UnboundField.Settings> <igDP:FieldSettings LabelPresenterStyle="{StaticResource LabelPresenterStyle}" /> </igDP:UnboundField.Settings> </igDP:UnboundField>
<igDP:UnboundField IsScrollTipField="False" BindingPath="ReferenceNumber" Label="{tp:Localize referenceNo}" Visibility="Visible" Width="*"> <igDP:UnboundField.Settings> <igDP:FieldSettings LabelPresenterStyle="{StaticResource LabelPresenterStyle}">
</igDP:FieldSettings> </igDP:UnboundField.Settings> </igDP:UnboundField>
<igDP:UnboundField IsScrollTipField="False" BindingPath="Description" Label="{tp:Localize descHeader}" Visibility="Visible" Width="*"> <igDP:UnboundField.Settings> <igDP:FieldSettings LabelPresenterStyle="{StaticResource LabelPresenterStyle}" > </igDP:FieldSettings> </igDP:UnboundField.Settings> </igDP:UnboundField> <igDP:UnboundField IsScrollTipField="False" BindingPath="Actions" Label="{tp:Localize actions}" Visibility="Visible" Width="auto"> <igDP:UnboundField.Settings>
<igDP:FieldSettings LabelPresenterStyle="{StaticResource LastColumn}" > <igDP:FieldSettings.CellValuePresenterStyle>
<Style TargetType="{x:Type igDP:CellValuePresenter}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate> <StackPanel Orientation="Horizontal"> <Button x:Name="edit_btn" Content="Edit" Margin="3,3,0,3" Width="50" Height="Auto" Command="{Binding RelativeSource={RelativeSource AncestorType={x:Type igDP:XamDataGrid} }, Path=DataContext.Commands.DeleteProjectReferenceCommand}"> <Button.Template> <ControlTemplate> <Image Source="pack://application:,,,/Cet.BaseModule.Client;component/Images/delete.ico" Width="16" Height="16"/> </ControlTemplate> </Button.Template>
</Button> </StackPanel> </ControlTemplate> </Setter.Value> </Setter> </Style>
</igDP:FieldSettings.CellValuePresenterStyle> </igDP:FieldSettings> </igDP:UnboundField.Settings> </igDP:UnboundField> </igDP:FieldLayout.Fields>
</igDP:FieldLayout> </igDP:XamDataGrid.FieldLayouts> </igDP:XamDataGrid >
and i have handled mouse click event in .cs file as follows
private void CellValuePresenter_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { if ((sender as CellValuePresenter).Record.IsActive && (sender as CellValuePresenter).Field.Index != 0 && (sender as CellValuePresenter).Field.Index != 4) { if (e.ClickCount == 2) { var presenter = sender as CellValuePresenter; if (null != presenter) { if (presenter.Field.Index != 0 && presenter.Field.Index != 4) { presenter.Editor.StartEditMode(); } else { return; } } } } }
when click on any cell ,if it is single click ,it will select the row and if it is double click then corresponding cell become in edit mode.
the proplem is when i edit values in cell ,it is not effected in the binded collection in model view.
it is an urgent requirement.
if any idea pls share me,
Regards ,
Jafar vm
Hello Jafar,
I am just checking if you got this worked out or you still require any assistance or clarification on the matter.
Thank you for your post. I have been looking into it and I can suggest you set the XamDataGrid’s FieldSettings’ CellClickAction Property to “SelectRecord”. This way by clicking on any Cell the user will select the Record and by double-clicking it he/she will enter in edit mode. Also you can set the XamDataGrid’s UpdateMode to value that best fit your requirement. Here you can see the possible values:
http://help.infragistics.com/Help/NetAdvantage/WPF/2013.1/CLR4.0/html/InfragisticsWPF4.DataPresenter.v13.1~Infragistics.Windows.DataPresenter.UpdateMode.html
Please let me know if this helps you or you need further assistance on this matter.
Looking forward for your reply.