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
1155
Validate and Modify Record at run time.
posted

I am using a converter (below) and CVP to identify text patterns in a particular column in my grid. When I find a matching entry, I want to modify it in the recordset and refresh or affect the view such that the modified version is displayed. E.G. If rox x column n contains "Fred" change to "Barney" etc.

Questions: Is this a sound approach? Is it possible to modify the record at run time and display the new value without reloading the whole thing? Can I pass the whole record or key fields via the CVP rather than just the field it is acting on?

I've attached the converter so you can get the idea of what I am trying to do. Below you can see I am scanning the Area name (looking for pattern) and attaching it to the UnitID field. The CVP returns the Area name to the converter. I would like to return the unitid also so I can use it to update the recordset (it is the key). 

Thanks,

Glenn

 <areaConverter:DuplicateAreaConverter x:Key="conv"/>

  <Style x:Key="filterAreaFieldValues" TargetType="{x:Type igDP:CellValuePresenter}">
      <Style.Triggers>
        <!-- RTO Edit Rule-->
        <DataTrigger Binding="{Binding Path=Field.Name, RelativeSource={RelativeSource Self}}" Value="UnitID">
                        <Setter Property="IsEnabled">
                        <Setter.Value>
                        <Binding Converter="{StaticResource conv}" Path="Record.Cells[Area].Value" RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type igDP:DataRecordPresenter}}"/>
                        </Setter.Value>
                        </Setter>
        </DataTrigger>
 </Style.Triggers>
 </Style>

Parents
  • 69686
    Suggested Answer
    posted

    Hello Glenn,

    I believe if you try using the InitializeRecord event, this will simplify things and will reflect the changes immediately. The InitializeRecord fires once a records is initialized or reinitialized. In the event args you have e.ReInitialize which you can use. You will need to iterate through the cells and make the appropriate changes.

    InitializeRecord would also fire when a value of a cell changes, so that you can keep your data synchronized.

Reply Children