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
1775
ConditionalFormattingCellControl is null when grouping is active
posted

Hello,

I have some ConditionalFormatRules for xamGrid (11.1) to add icons to cells. And I want to export this icons to Excel. So I get icon from

(row.Cells[i] as ConditionalFormattingCell).Control as ConditionalFormattingCellControl

and everything is ok. But if option xamGrid.GroupBySettings.GroupByOperation is set to GroupByOperation.GroupByRows then (row.Cells[i] as ConditionalFormattingCell).Control is null and I can't get icon from it.

  • 1775
    posted

    So, is there any way to get cells to which ConditionalFormatRule should be applied?

    • 35319
      posted in reply to Sergey

      Hello ,

       

      I am just checking if you require any further assistance on the matter.

      • 1775
        posted in reply to [Infragistics] Yanko

        Hello,

        Thanks for registering product idea, I hope you will realize this idea.

      • 35319
        posted in reply to Sergey

        HelloSergey,

        Sorry for the late response.

         

        After some research the functionality that you are looking for has been determined to be a new product idea.  I have sent your product idea directly to our product management team.  Our product team chooses new product ideas for development based on popular feedback from our customer base.  Infragistics continues to monitor application development for all of our products, so as trends appear in requested ideas, we can plan accordingly.

         

        We value your input, and our philosophy is to enhance our toolset based on customer feedback.  If your idea is chosen for development, you will be notified at that time.  Your reference number for this product idea is PI12060059.

         

        If you would like to follow up on your product idea at a later point, you may contact Developer Support management via email.  Please include the reference number of your product idea in the subject and body of your email message.  You can reach Developer Support management through the following email address:  dsmanager@infragistics.com

         

        Thank you for your request.

      • 35319
        posted

        Hello,

         

        I have been looking into your issue and would you please provide me with your sample application in order to investigate this behavior ?

         

        Looking forward to hearing from you.

         

        • 1775
          posted in reply to [Infragistics] Yanko

          We use the following code to export icons to MS Excel

          foreach (Column column in this.grid.Columns.AllVisibleChildColumns)
                      {
                          var conditionalFormattingCell = row.Cells[column] as ConditionalFormattingCell;
                          if (conditionalFormattingCell != null)
                          {
                              ConditionalFormattingCellControl cellControl = conditionalFormattingCell.Control as ConditionalFormattingCellControl;
                              if (cellControl != null && cellControl.Icon != null)
                              {
                                  BitmapImage image = new BitmapImage();
                                  image.CreateOptions = BitmapCreateOptions.None;
                                  image.UriSource = ((cellControl.Icon.LoadContent() as Image).Source as BitmapImage).UriSource;
                                  WriteableBitmap writeableBitmap = new WriteableBitmap(image);
                                  WorksheetShape worksheetShape = new WorksheetImage(writeableBitmap, new PngImageEncoder(), null);
                                  worksheetShape.PositioningMode = ShapePositioningMode.MoveWithCells;
                                  WorksheetCell cell = sheet.Rows[startRow].Cells[currentColumn + startColumn];
                                  worksheetShape.TopLeftCornerCell = cell;
                                  worksheetShape.TopLeftCornerPosition = new Point(0.0F, 0.0F);
                                  worksheetShape.BottomRightCornerCell = cell;
                                  worksheetShape.BottomRightCornerPosition = new Point(33, 40);
                                  workSheet.Shapes.Add(worksheetShape);
                              }
                          }
                          this.SetCellValue(sheet.Rows[startRow].Cells[currentColumn + startColumn], row.Cells[column] as Cell);
                          currentColumn++;
                      }

          • 35319
            posted in reply to Sergey

            Hello Sergey,

             

            I have been looking into this and when the icon is not visible, it doesn’t export. I can suggest looking through the following forum thread where Krasimir has provided an approach on how can export an image to Excel :

             

            http://forums.infragistics.com/forums/p/57334/292534.aspx

             

            If you have any other questions on this matter, feel free to ask.

            • 1775
              posted in reply to [Infragistics] Yanko

              I downloaded 2266 SR and it solved part of this problem. But if icon is not in visible area of grid, it doesn't export to Excel as it is null in CellControl.

              • 35319
                posted in reply to Sergey

                Hello Sergey,

                 

                Would you please download our latest Service Release for NetAdvantage 11.1 because it seems that this issue is fixed there. You can download it from the following link from our website :

                 

                https://www.infragistics.com/Login.aspx?ReturnUrl=%2fMembership%2fDefault.aspx%3fpanel%3dDownloads&panel=Downloads

                 

                If this issue still appears, please attach an image file of the XamGrid before exporting to Excel.

                 

                Looking forward to hearing from you.

                • 1775
                  posted in reply to [Infragistics] Yanko

                  I have attached sample solution. Use "Load" button to load sample data and "Excel" to export it. The code working with exporting icon is placed to WriteDataRow function.

                  SilverlightApplication1.rar
                  • 35319
                    posted in reply to Sergey

                    Hello Sergey,

                     

                    Thank you for the provided code but it is not enough to reproduce your scenario. It seems that some methods and properties’ declarations are missing. Is there any reason because of which you are not able to attach your isolated sample application?

                     

                    Looking forward to hearing from you.