DataBand.EvenStyle Dynamically not working...

I cannot get the EvenStyle to work...do I have the syntax correct?  

  var report = new FastReport.Report();  

var dataBand = new DataBand();

//Style - Start? WIP

      var dataBandEvenStyle = new FastReport.Style();

      dataBandEvenStyle.Font = new Font("Tahoma", 20, FontStyle.Bold);

      dataBandEvenStyle.Name = "dataBandEvenStyle";

      dataBandEvenStyle.ApplyBorder = true;

      dataBandEvenStyle.Border.Shadow = true;

      report.Styles.Add(dataBandEvenStyle);

      dataBand.EvenStyle = dataBandEvenStyle.Name;

        //Style - End?

Comments

  •  EvenStylePriority?

  • Hello!

    The DataBand.EvenStyle property takes the name of a style that has been previously added to report.Styles; furthermore, the style itself must have the ApplyFill = true flag set (and/or the ApplyFont and ApplyBorder flags), and the row objects must have EvenStylePriority set to UseAll or UseFill, so that the band style overrides their own background:

    var evenStyle = new FastReport.Style
    {
    Name = ‘EvenRowStyle’,
    Fill = new FastReport.SolidFill(System.Drawing.Color.Silver),
    ApplyFill = true,
    ApplyFont = true,
    Font = new System.Drawing.Font(‘Tahoma’, 10, System.Drawing.FontStyle.Bold)
    };
    report.Styles.Add(evenStyle);
    
    dataBand.EvenStyle = ‘EvenRowStyle’;
    // On objects within the DataBand (or when creating them):
    textObj.EvenStylePriority = StylePriority.UseAll; // so that both the font and the fill are applied
    
This discussion has been closed.