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.