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
145
XamDataGrid: Displaying different editors in a field based on row data
posted

So in each record (row) what I am trying to do is either display a XamTextEditor or a XamComboEditor in Field 2 (column) based on the value of the Field 1 (column) in each record.  The only way I have found to do this is to override the CellValuePresenter Style in the following manner.    This creates the following problems that are only present in Field 2 (the field in which I am using my custom CellValuePresenterTemplate).

1) The IDataErrorInfo support I set in the parent XamDataGrid  (via SupportDataErrorInfo="RecordsAndCells") and the custom error template I have defined (via <Style x:Key="{x:Static igDP:DataPresenterBase.DataErrorIconStyleKey}" TargetType="{x:Type Control}" > **** </Style > ) are both not applied to the igEditors in my CVP template

2) The controls that are displayed are seemingly only using thier edit templates because the XamTextEditors are not showing as a TextBlock when they are not in the selected cell.

I'm sure that these issues are happening because I'm creating my own CellValuePresenter template from scratch and not just editing the Infragistics CellValuePresenter that is provided.  This being the case how would I go about modifying the existing CellValuePresenter style to get the functionality I want?

Below is the CVP  

 

Style x:Key="DestinationSwitchField" TargetType="{x:Type igDP:CellValuePresenter}" >

<Setter Property="Template">

<Setter.Value> 

<ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}">

<Grid x:Name="container">

<igEditors:XamTextEditor Visibility="{Binding Path=DataItem.DestinationATCapType.Description, Converter={StaticResource StrCmpToVisConverter}, ConverterParameter='State'}"

Value="{Binding Path=DataItem.Destination}"/>

<igEditors:XamTextEditor Visibility="{Binding Path=DataItem.DestinationATCapType.Description, Converter={StaticResource StrCmpToVisConverter}, ConverterParameter='Postal Code'}"

Value="{Binding Path=DataItem.Destination}"/>

<igEditors:XamTextEditor EditTemplate="{StaticResource XamTextEditor_DestinationLocationEditTemplate}"

Visibility="{Binding Path=DataItem.DestinationATCapType.Description, Converter={StaticResource StrCmpToVisConverter}, ConverterParameter='Location'}"

Value="{Binding Path=DataItem.Destination}"/>

<igEditors:XamTextEditor EditTemplate="{StaticResource XamTextEditor_DestinationCityEditTemplate}"

Visibility="{Binding Path=DataItem.DestinationATCapType.Description, Converter={StaticResource StrCmpToVisConverter}, ConverterParameter='City'}"

Value="{Binding Path=DataItem.Destination}"/>

<igEditors:XamComboEditor Visibility="{Binding Path=DataItem.DestinationATCapType.Description, Converter={StaticResource StrCmpToVisConverter}, ConverterParameter='Region'}"

SelectedItem="{Binding Path=DataItem.DestinationRegion}"

ItemsSource="{Binding Path=DataContext.PartyAutoTenderRegionList, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl

}}}"

DisplayMemberPath="Name"/>

</Grid> 

</ControlTemplate> 

</Setter.Value> 

</Setter> 

</Style>