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
110
Custom CellValuePresenter Style = no Events ?
posted

Hi,

 When using a custom CellValuePresenter style on my grid, the edit events, and tab functions have all stopped working. The custom style is working as expected, but has lost its default events.

Help !

The style is as follows:

<Style x:Key="cellValidationStyle" TargetType="{x:Type igDP:CellValuePresenter}">  
  
  <Setter Property="Template">
   <Setter.Value>
    <ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}">  
     
     <StackPanel>  
      <Grid Width="Auto" Height="Auto">  
       <!--<TextBox Text="{Binding Path=Value, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Margin="5,0,139,12" Width="Auto" Height="Auto" MinWidth="300"/>-->
              
       <igEditors:XamTextEditor Value="{Binding Path=Value, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"/>
       
       <Image x:Name="ErrorIcon"
        Height="15" Source="erricon.gif" Visibility="Hidden" VerticalAlignment="Top" RenderTransformOrigin="7.776,0.215" HorizontalAlignment="Right" Margin="0,1.852,120.175,0" Width="15"/> 
    
      </Grid> 
    
     </StackPanel>
          
     <ControlTemplate.Triggers>
                        <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Record, Converter={StaticResource validationErrorConverter}}" Value="False">

                            <Setter Property="Visibility"
                                    TargetName="ErrorIcon"
                                    Value="Visible" />
         
                        </DataTrigger>
                     </ControlTemplate.Triggers>
     
             
    </ControlTemplate>
   </Setter.Value>
  </Setter>    
  
 </Style>    

 

 

Parents
No Data
Reply
  • 8576
    Offline posted
    Hi -
     
    This is happening because you are placing the editor in the template manually rather than letting the grid do it so it can do all of its required 'hook ups'.  
     
    To ensure that all the editing events and navigation work (i.e., that the grid 'hooks up' all the editors properly), you should place a ContentPresenter with the name "PART_EditorSite" where you want the editor to appear (i.e., where you currently have the XamTextEditor element in your template). 
     
    When the XamDataGrid is applying the template for the cell it looks for a ContentPresenter element in the template with the name "PART_EditorSite".  If it is found, the XamDataGrid creates the appropriate editor (based on the DataType of the Field or based on the EditAsType if it is set on the Field's FieldSettings object) and sets it as the content of the PART_EditorSite with all the appropriate hookups.
     
    Joe
     
Children