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
370
Custom Template implementation for Row summaries
posted

Hi,

The datagrid in my application has multiple Summarydefinitions as row summaries for the same field.

 They are placed one below the other. I want to right align the value part of the summary definitions. I am

finding difficult to implement a custom template targeting the rowsummary. Is there a way by which we

make use of the grid in the custom template placing  header and value in seperate columns so that we

can align the items appropriatly?

ex: Stringformat = "Amount: {}{0:C}"  placing Amount in one column and the value in other. 

Please do send me a code snippet if this is possible.

Thanks in advance.

 

  • 2426
    Verified Answer
    posted

    Toreador,

    I don't see a Mask property for the Texbblock so using the xamTextEditor, I believe you would have to bind the xamTextEditor's Value property to the value of the SummaryResultPresenter's SummaryResult.Value Path.

  • 69686
    Verified Answer
    posted

    Hello,

    The following code snippet will do the trick:

            <Style TargetType="{x:Type igDP:SummaryResultPresenter}">

                <Setter Property="Padding" Value="1,1"/>

                <Setter Property="Template">

                    <Setter.Value>

                        <ControlTemplate TargetType="{x:Type igDP:SummaryResultPresenter}">

                            <Border

    Background="{TemplateBinding Background}"

    BorderBrush="{TemplateBinding BorderBrush}"

    BorderThickness="1"

    Padding="{TemplateBinding Padding}"

    ToolTip="{Binding Path=SummaryResult.ToolTipResolved, RelativeSource={RelativeSource TemplatedParent}}">

                                <Grid Margin="2">

                                    <Grid.ColumnDefinitions>

                                        <ColumnDefinition Width="Auto"/>

                                        <ColumnDefinition Width="5*"/>

                                    </Grid.ColumnDefinitions>

                                    <TextBlock Grid.Column="0" Text="{Binding Path=SummaryResult.SummaryDefinition.Calculator, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" HorizontalAlignment="Left"/>

                                    <TextBlock  Grid.Column="1" Foreground="BurlyWood" Text="{Binding Path=SummaryResult.Value, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" HorizontalAlignment="Right"/>

                                </Grid>

                            </Border>

                        </ControlTemplate>

                    </Setter.Value>

                </Setter>

                <Setter Property="Margin" Value="0,0,0,0"/>

            </Style>

    We ship the generic styles for your components and you can find them in the DefaultStyles directory in the Infragistics Folder on your computer.

    Hope this helps,
    Alex.