Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1715
xamdatagrid not updating the collection source
posted

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