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
1715
Difficulty in styling cells
posted

I have 20 fields and would like to style all cells of one field in a certain way. I was thinking the following XAML would do the trick, but it does nothing.

<igDP:Field Name="Status">
              <igDP:Field.Label>
                <Label Name="LabelStatus">
                  <TextBlock TextWrapping="Wrap">Status</TextBlock>
                </Label>
              </igDP:Field.Label>

              <igDP:Field.Settings>
                <igDP:FieldSettings AllowEdit="False" LabelWidth="80" CellWidth="80">
                  <igDP:FieldSettings.CellPresenterStyle>
                    <Style TargetType="{x:Type igDP:CellPresenter}">
                      <Setter Property="Background" Value="Yellow" />
                      <Setter Property="Foreground" Value="Green" />
                      <Setter Property="FontSize" Value="16" />
                    </Style>
                  </igDP:FieldSettings.CellPresenterStyle>
                </igDP:FieldSettings>
              </igDP:Field.Settings>
            </igDP:Field>

 

Any ideas as to what might be wrong?

 

Thanks! 

Parents
No Data
Reply
  • 9694
    posted

    Hello,

    It is my understanding that it is the CellValuePresenterStyle which needs to be styled to achieve changing the text style in a column of cells.

    The following snippet will change the text color and size for all the fields in the specified column. I noticed trying to color the TextBlock background color does not work. More than likely the coloring of the background is overridden in other areas. The CellValuePresenter does alow for modifying several of the background brushes. I've included a Setter for changing the hover color for the background.

    <igDP:Field.Settings>
     
    <igDP:FieldSettings>
       
    <igDP:FieldSettings.CellValuePresenterStyle>
         
    <Style TargetType="{x:Type igDP:CellValuePresenter}">
           
    <Setter Property="ForegroundStyle">
             
    <Setter.Value>
               
    <Style>
                 
    <Setter Property="TextBlock.Foreground" Value="Green" />
                 
    <Setter Property="TextBlock.Background" Value="Yellow" />
                 
    <Setter Property="TextBlock.FontSize" Value="16" />
               
    </Style>
             
    </Setter.Value>
           
    </Setter>
           
    <Setter Property="BackgroundHover" Value="Purple"/>
          
    </Style>
       
    </igDP:FieldSettings.CellValuePresenterStyle>
     
    </igDP:FieldSettings>
    </
    igDP:Field.Settings>

    One suggestion is to send in a feature request asking to simplify the various ways to customize a data grid.
    http://devcenter.infragistics.com/Protected/RequestFeature.aspx

    Thank you

Children