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
390
How to invoke IValueConverter programatically
posted

We have defined custom summary style for SummaryRowCellControl with IValueConverter as below:

       <Style x:Key="CustomSummaryStyle" TargetType="igPrim:SummaryRowCellControl">
            <Setter Property="FontSize" Value="11" />
            <Setter Property="VerticalContentAlignment" Value="Center" />
            <Setter Property="HorizontalContentAlignment" Value="Right"/>
            <Setter Property="Background" Value="{StaticResource SummaryRowBackgroundBrush}"/>
            <Setter Property="BorderBrush" Value="{StaticResource CellItemNormalBorderBrush}"/>
            <Setter Property="BorderThickness" Value="0,0,0,0"/>
            <Setter Property="Padding" Value="7,3"/>
            <Setter Property="SummaryDisplayTemplate" >
                <Setter.Value>
                    <DataTemplate>
                        <TextBlock Text="{Binding Converter={StaticResource RowCountConverter}}"/>
                    </DataTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="igPrim:SummaryRowCellControl">
                        <Grid>
                                                       
                            <Border x:Name="AddNewRowElem" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
                                <!--<Rectangle Height="1" VerticalAlignment="Top" Fill="#7FFFFFFF" />-->
                                <StackPanel x:Name="SummaryDisplay" HorizontalAlignment="Right" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}"/>
                            </Border>
                            <Rectangle Fill="Transparent" Stroke="{StaticResource CellItemSelectedBorderBrush}" StrokeThickness="1" x:Name="ActiveRect" Visibility="Collapsed"></Rectangle>
                         
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

 

and applied "Count" summary operand in one of the column of XamGrid.

 

IValueConverter "RowCountConverter" which is defined in  "SummaryDisplayTemplate" property of summary style is used for counting the grid rows

Now my question is how to invoke this "RowCountConverter" from code behind.

Please suggest.

  • 40030
    Offline posted

    Hi, 

    I'm not exactly sure what you're trying to do. 

    Why do you need to invoke your RowCountConverter?  Are you trying to use is separately from the SummaryRowCell? Or are you trying to refresh the summary cell?

    The more information you can provide about what you're trying to do, the more i'll be able to help you. 

    Thanks, 

    -SteveZ