Welcome to the Xceed Community Sign in | Join | Help
Community Search  

How to update a StatRow programmatically

Sort Posts: Previous Next
  •  05-13-2008, 1:48 AM Post no. 12194

    How to update a StatRow programmatically

    I have a StatRow in a FixedFooter that calculates a sum of a column. When a value changes in the underlying data collection, how can I force the StatRow to refresh? I would expect that changing the value through the grid would have caused the refresh - but it doesn't. At this point, I have coded the collection to send the change event, but I can't figure out how to make the StatRow redraw after changing a row in the grid. Any help?
  •  05-13-2008, 8:36 AM Post no. 12209 in reply to 12194

    Re: How to update a StatRow programmatically

    The StatRow should update automatically if the values that are being changed are in its StatContext. Do you have any errors in the output window? How is your StatRow defined?
    Technical Writer - Xceed Software

    Of all the things I've lost, I miss my mind the most. - Mark Twain
  •  05-13-2008, 11:51 AM Post no. 12217 in reply to 12209

    Re: How to update a StatRow programmatically

    Here it is... If I just edit a value in the grid and press Enter to EndEdit the row, then I would expect that the StatRow would update. It doesn't do anything... If I rebind the grid to another data source and back again then it re-calculates as expected.

     <Grid Grid.Column="1">

    <Grid.Resources>

    <xcdg:DataGridCollectionViewSource x:Key="DeductionsGridView" x:Name="DeductionsGridView" Source="{Binding Path=Deductions}">

    <xcdg:DataGridCollectionViewSource.StatFunctions>

    <xcdg:SumFunction ResultPropertyName="WeeklyPayment_Sum" SourcePropertyName="WeeklyPaymentNotNullable"/>

    <xcdg:SumFunction ResultPropertyName="NextPayrollAmount_Sum" SourcePropertyName="NextPayrollAmountNotNullable"/>

    </xcdg:DataGridCollectionViewSource.StatFunctions>

    </xcdg:DataGridCollectionViewSource>

    </Grid.Resources>

    <Grid.RowDefinitions>

    <RowDefinition Height="*"/>

    <RowDefinition Height="Auto" />

    </Grid.RowDefinitions>

    <xcdg:DataGridControl Name="DeductionsGrid" Grid.Row="0"

    ItemsSource="{Binding Source={StaticResource DeductionsGridView}}"

    AutoCreateColumns="False"

    CellEditorDisplayConditions="RowIsCurrent"

    >

    <xcdg:DataGridControl.View>

    <xcdg:TableView ShowFixedColumnSplitter="False">

    <xcdg:TableView.FixedFooters>

    <DataTemplate>

    <Border Background="#999999"

    BorderBrush="LightBlue"

    BorderThickness="0, 3, 0, 3"

    >

    <xcdg:StatRow Background="AliceBlue" Loaded="StatRow_Loaded">

    <xcdg:Cell FieldName="DeductionRecurrenceSource" Visibility="Hidden"/>

    <xcdg:StatCell FieldName="WeeklyPayment" ResultPropertyName="WeeklyPayment_Sum" ContentTemplate="{StaticResource currencyCellDataTemplate}"/>

    <xcdg:StatCell FieldName="NextPayrollAmount" ResultPropertyName="NextPayrollAmount_Sum" ContentTemplate="{StaticResource currencyCellDataTemplate}"/>

    </xcdg:StatRow>

    </Border>

    </DataTemplate>

    </xcdg:TableView.FixedFooters>

    </xcdg:TableView>

    </xcdg:DataGridControl.View>

    <xcdg:DataGridControl.Resources>

    <ResourceDictionary>

    <Style TargetType="xcdg:GroupByControl">

    <Setter Property="Visibility" Value="Collapsed"/>

    </Style>

    </ResourceDictionary>

    </xcdg:DataGridControl.Resources>

     

    <xcdg:DataGridControl.Columns>

    <xcdg:Column FieldName="DeductionRecurrenceSource" Title="Src" Width="33" ReadOnly="True">

    <xcdg:Column.CellContentTemplate>

    <DataTemplate>

    <TextBlock Name="DeductionRecurrenceSourceValue" Grid.Column="1" Text="Xml"/>

    <DataTemplate.Triggers>

    <DataTrigger Binding="{Binding}" Value="Select">

    <Setter TargetName="DeductionRecurrenceSourceValue" Property="Text" Value="Sel">

    </Setter>

    </DataTrigger>

    </DataTemplate.Triggers>

    </DataTemplate>

    </xcdg:Column.CellContentTemplate>

    </xcdg:Column>

    <xcdg:Column FieldName="Description" Title="Description" Width="250" CellEditor="{StaticResource genericCellDataEditor}">

    <xcdg:Column.CellValidationRules>

    <local:EntityFieldValidationRule/>

    </xcdg:Column.CellValidationRules>

    </xcdg:Column>

    <xcdg:Column FieldName="CurrentBalance" Title="Balance" Width="75" CellContentTemplate="{StaticResource currencyCellDataTemplate}" CellEditor="{StaticResource genericCellDataEditor}">

    <xcdg:Column.CellValidationRules>

    <local:EntityFieldValidationRule/>

    </xcdg:Column.CellValidationRules>

    </xcdg:Column>

    <xcdg:Column FieldName="WeeklyPayment" Title="Weekly" Width="75" CellContentTemplate="{StaticResource currencyCellDataTemplate}" CellEditor="{StaticResource genericCellDataEditor}">

    <xcdg:Column.CellValidationRules>

    <local:EntityFieldValidationRule/>

    </xcdg:Column.CellValidationRules>

    </xcdg:Column>

    <xcdg:Column FieldName="NextPayrollAmount" Title="Next Payroll" Width="75" CellContentTemplate="{StaticResource currencyCellDataTemplate}" CellEditor="{StaticResource genericCellDataEditor}">

    <xcdg:Column.CellValidationRules>

    <local:EntityFieldValidationRule/>

    </xcdg:Column.CellValidationRules>

    </xcdg:Column>

    <xcdg:Column FieldName="DeductionType" Title="Deduction Type" CellContentTemplate="{StaticResource DeductionTypeTemplate}">

    <xcdg:Column.CellEditor>

    <xcdg:CellEditor EditTemplate="{StaticResource DeductionTypeListTemplate}" />

    </xcdg:Column.CellEditor>

    <xcdg:Column.CellValidationRules>

    <local:EntityFieldValidationRule/>

    </xcdg:Column.CellValidationRules>

    </xcdg:Column>

    <xcdg:Column FieldName="EffectiveDate" Title="Effective Date" Width="90" CellContentTemplate="{StaticResource dateOnlyCellDataTemplate}" >

    <xcdg:Column.CellValidationRules>

    <local:EntityFieldValidationRule/>

    </xcdg:Column.CellValidationRules>

    </xcdg:Column>

    <xcdg:Column FieldName="LastUpdatedDt" Title="Last Updated" Width="90" CellContentTemplate="{StaticResource dateOnlyCellDataTemplate}" ReadOnly="True">

    </xcdg:Column>

    </xcdg:DataGridControl.Columns>

    </xcdg:DataGridControl>

    <StackPanel Orientation="Horizontal" Grid.Row="1" >

    <Button Name="AddNewDeductionBtn" Command="{x:Static local:MainView.AddDeductionCommand}">Add New Deduction</Button>

    <Button Name="DeleteDeductionBtn" Command="{x:Static local:MainView.DeleteDeductionCommand}">Delete Deduction</Button>

    </StackPanel>

    </Grid>

  •  05-14-2008, 8:32 AM Post no. 12244 in reply to 12217

    Re: How to update a StatRow programmatically

    Hi Adam,

    I was unable to reproduce the behavior you are reporting. Would it be possible for you to send a repro application to my attention at support@xceedsoft.com?


    Technical Writer - Xceed Software

    Of all the things I've lost, I miss my mind the most. - Mark Twain
View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2008 Xceed Software Inc.