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
1280
Field styling with CellValuePresenter what item is used for editing ?
posted

Hi,

I have the following scenario:

XamDataGrid with some fields, and some of these fields has the following Style:

<igDp:Field Name="Description" Label="Description" IsScrollTipField="True"  Width="3*">
        <igDp:Field.Settings>
                <igDp:FieldSettings CellValuePresenterStyle="{StaticResource DataGridOrderAndContractLinesCellValuePresenter}"/>
        </igDp:Field.Settings>
 </igDp:Field>
<igDp:Field Name="Value" Format="{}#.00" Label="Value" LabelTextAlignment="Right" Width="2*">
          <igDp:Field.Settings>
                   <igDp:FieldSettings CellValuePresenterStyle="{StaticResource DataGridOrderAndContractLinesCellValuePresenter}"/>
           </igDp:Field.Settings>
</igDp:Field>

Each field refers to the following style:

<Style x:Key="DataGridOrderAndContractLinesCellValuePresenter" TargetType="{x:Type igDp:CellValuePresenter}">
        <Setter Property="CornerRadius" Value="0"/>
        <Setter Property="BorderThickness" Value="0,0,0,1" />
        <Setter Property="Margin" Value="0"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="Background" Value="Yellow"/>
        <Setter Property="Foreground" Value="Black"/>
        <Setter Property="BorderBrush" Value="Gray"/>
        <Setter Property="FontFamily" Value="Verdana"/>
        <Setter Property="FontSize" Value="9pt"/>
        <Setter Property="FontWeight" Value="Bold"/>
        <Setter Property="Padding" Value="0"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type igDp:CellValuePresenter}">
                    <igControls:CardPanel>
                        <Border x:Name="MainBorder" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0" CornerRadius="0"/>
                        <ContentPresenter x:Name="PART_EditorSite" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="5,0" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                    </igControls:CardPanel>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOverRecord" Value="True">
                            <Setter Property="Background" Value="Yellow"/>
                        </Trigger>
                        <Trigger Property="IsRecordSelected" Value="true">
                            <Setter Property="Background" Value="Orange"/>
                        </Trigger>
                        <Trigger Property="IsSelected" Value="true">
                            <Setter Property="Background" Value="Orange"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

And this correctly results into this:

But once I enter the edit mode, the description looks ok, while the value is not visible:

Looks empty but there are values.

then I have added the following styles:

<Style TargetType="{x:Type igEditors:XamNumericEditor}">
      <Setter Property="Foreground" Value="Red" />
</Style>
 <Style TargetType="{x:Type TextBox}">
       <Setter Property="Foreground" Value="Black"/>
</Style>
<Style TargetType="{x:Type igEditors:XamCurrencyEditor}">
        <Setter Property="Foreground" Value="Green" />
</Style>
<Style TargetType="{x:Type igEditors:XamMaskedEditor}">
         <Setter Property="Foreground" Value="DeepSkyBlue" />
</Style>
<Style TargetType="{x:Type igEditors:XamTextEditor}">
         <Setter Property="Foreground" Value="MediumPurple" />
</Style>

Which resulted in the following:

It only affected the not edit mode, the edit mode is still the same:

What control is used for the editing mode ? As you can see I also added  a style for TextBox, but that did not affect the edit mode of values.

Parents
  • 7535
    Verified Answer
    Offline posted

    Hello Nawed

    Thank you for posting. I followed the steps you suggested and was unable to reproduce the behavior you're describing.

    I created a sample of XamDataGrid with some fields and used the style you provided as it is. Now when I run the sample and enter the editmode of any cell, the value is still visible.it doesn't disappear for any of the cell.

    I have attached the sample project I used to test this. Please test this project on your PC; whether or not it works correctly may help indicate the nature of this problem.

    If the project does not work correctly, then the change in behavior is due to differences in your environment from mine and these differences can be anything from operating system version to the specific version of the Infragistics DLL versions used. My test was performed using version 18.1.20181.105. Please provide more details about your machine and version of the assemblies that you are referencing so that I can modify the environment that I am testing in to match yours.

    If the project does show the product feature working correctly, then more information will be needed to reproduce the issue in a sample that can be used for debugging. It will help if you can provide a small, isolated sample application that demonstrates the behavior you are seeing. This can be done by either making the sample that I provided more like your application or by isolating the behavior from your application by removing dependencies on any third parties or databases.

    Please let me know if I can provide any further assistance.

    Sincerely,
    Divya Jain
    Associate S/W developer

    DataGrid_GetCellFromCVP_Modified.zip

Reply Children
No Data