Home Forums WinForms controls Xceed Grid for WinForms ValueRow cells have cell viewer managers?

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #15449 |

    Hi,

    How can I make cells in the foot value rows not use the column’s cell viewer manager ?

    I have a grid like this:

    | Merchant | Applied To | Amount |
    ———————————————
    | Taco Bell | Interest | $20 |
    | Wendy’s | Credit | ($50)|
    | _______ |______ TOTAL | ($30)|

    The “Applied To” column has a ComboBoxViewer for the viewer manager. It converts “Applied To” codes to descriptions such as “Interest” or “Credit”.

    The last row is a value row added to the footer rows. It contains cell values that’s manually set from code and doesn’t come from the grid’s data source.

    Right now the word “TOTAL” doesn’t show up because it is not a “Applied To” value, so the combo box viewer just displays a blank.

    How do I get the word “TOTAL” to show up?

    Thanks.

    Hao

    ps: the spaces aren’t showing up for the chart above.

    Imported from legacy forums. Posted by hao_jiang (had 3433 views)

    User (Old forums)
    Member
    Post count: 23064

    You can use a SummaryRow instead of a ValueRow. You will be able to display the TOTAL and it will calculate the Amount automatically. Simply set the SummaryCell StatFunction to Sum, and set its TitleFormat to TOTAL.

    Imported from legacy forums. Posted by André (had 356 views)

    User (Old forums)
    Member
    Post count: 23064

    I tried to use a Summary row. When I tried to put the word “TOTAL” in the cell, I got an error saying “The value is automatically calculated and is not modifiable”. So I guess a summary row won’t work if I want to put some text there.

    Also, actually I have two value rows with two different totals. The other total is not a simple sum and has to be calculated manually.

    Imported from legacy forums. Posted by hao_jiang (had 490 views)

    User (Old forums)
    Member
    Post count: 23064

    You need to set this on the TitleFormat property, not on the Value property, and decide on which side of the actual total (the result of the StatFunction) will it display.

    e.g.:

    ( ( SummaryCell )summaryRow1.Cells[ “Quantity” ] ).StatFieldName = “Quantity”;
    ( ( SummaryCell )summaryRow1.Cells[ “Quantity” ] ).StatFunction = StatFunction.Sum;
    ( ( SummaryCell )summaryRow1.Cells[ “Quantity” ] ).TitleFormat = “Quantity”;
    ( ( SummaryCell )summaryRow1.Cells[ “Quantity” ] ).TitlePosition = TitlePosition.PreferablyLeft; //this is the default value

    As for the second total, you have two choices. If the you can’t use the SummaryRow’s available <a href=”http://doc.xceedsoft.com/products/XceedGrid/Xceed.Grid~Xceed.Grid.StatFunction.html”>functions</a&gt; to make the calculation, you can use the adjacent cell to display it as a string. For example, you want to calculate the Quantity column, and there is the Description column to its left that does not have a calculation at the bottom, and calculatedValue is the result of your manual calculation :

    ( ( SummaryCell )summaryRow1.Cells[ “Description” ] ).StatFieldName = “Description”;
    ( ( SummaryCell )summaryRow1.Cells[ “Description” ] ).TitlePosition = TitlePosition.PreferablyRight;
    ( ( SummaryCell )summaryRow1.Cells[ “Description” ] ).TitleFormat = calculatedValue.ToString();

    The other choice is to use the ValueRow, but redefine a CellEditorManager and CellViewerManager on the cells you need to display your results or texts, and use the type of editor you need (e.g a text editor for string, a numeric editor for a integer, etc.. )

    e.g.:

    WinTextBox textBox = new WinTextBox( EnhancedBorderStyle.None );
    valueRow1.Cells[ “Applied to” ].CellEditorManager = new CellEditorManager( textBox, “Text”, true, true );
    valueRow1.Cells[ “Applied to” ].CellViewerManager = new CellViewerManager( textBox, “Text” );

    Then later in your code, you will be able to set the calculated value or the display text, once the ValueRow has been created by the grid.

    e.g.:

    valueRow1.Cells[ “Applied to” ].Value = “TOTAL”;

    Imported from legacy forums. Posted by André (had 451 views)

    User (Old forums)
    Member
    Post count: 23064

    I set the cell viewer manager to text manager and it works now.

    Thanks!

    Imported from legacy forums. Posted by hao_jiang (had 4449 views)

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.