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
560
Different Styles for SummaryResultPresenter ?
posted

Hello, is it possible to use different Styles for the SummaryResultPresenter in one Grid?

I would like to use 2 Styles, one has some labels with static content, and the other one has TextBox Controls which are under specific columns.

The first one i have created works, but how to change dynamically under specific columns the Style of the Summary, is it possible?

 

My first style with the static content:

<Style x:Name="FooterDescription" TargetType="{x:Type igDP:SummaryResultsPresenter}">
<Style.Resources>
    <DataTemplate DataType="{x:Type igDP:SummaryResult}">
        <igDP:SummaryResultPresenter SummaryResult="{Binding}"/>
    </DataTemplate>
</Style.Resources>
<Setter Property="Template">
<Setter.Value>
    <ControlTemplate TargetType="{x:Type igDP:SummaryResultsPresenter}">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition></ColumnDefinition>

        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>

            <RowDefinition ></RowDefinition>
            <RowDefinition ></RowDefinition>
            <RowDefinition ></RowDefinition>                                 

        </Grid.RowDefinitions>

        <Label Content="Description1" Grid.Column="0" Grid.Row="0"></Label>
        <Label Content="Description2" Grid.Column="0" Grid.Row="1"></Label>
        <Label Content="Description3" Grid.Column="0" Grid.Row="2"></Label>

    </Grid>

    </ControlTemplate>
</Setter.Value>
</Setter>
</Style>

 

 

This style must be set only under one column:

 

 

<igDP:FieldLayout.SummaryDefinitions >
                 
    <igDP:SummaryDefinition Key="MA" SourceFieldName="MA" Calculator="Count" />

</igDP:FieldLayout.SummaryDefinitions>



So for the other important columns i need another
SummaryResultsPresenter or someting matchable,
has listed some TextBox Controls, these must be filled with data.

   

I would like create another Style and then assign the specific columns
with the Style, something like this.

Example


 

<igDP:FieldLayout.SummaryDefinitions >

    <igDP:SummaryDefinition Style="{StaticResource FooterDescription}" Key="DescriptionCol" SourceFieldName="DescriptionCol" Calculator="Count" />

    <igDP:SummaryDefinition Style="{StaticResource DataSum}" Key="Col1" SourceFieldName="Col1" Calculator="Count" />

    <igDP:SummaryDefinition Style="{StaticResource DataSum}" Key="Col2" SourceFieldName="Col2" Calculator="Count" />

</igDP:FieldLayout.SummaryDefinitions>



I need different Summary Layouts, how to set this`??


  • 27093
    posted

    Hello Patrick,

    I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.

    If the above suggestion helped you solve your issue please verify the thread as answered so other users may take better advantage of it.

    Sincerely,

    Petar Monov

    Developer Support Engineer

    Infragistics Bulgaria

    www.infragistics.com/support

     

  • 27093
    posted

    Hello Patrick,

     

    I did a bit of digging around and was able to find a way for you to achieve you goal. What you can do is still use the keyless Style that would apply to all SummaryResultPresenters, but with DataTriggers. Since you do not have direct access to the name of the Field, which would trigger any difference in the presenter’s appearance I have created a IValueConverter to get to the Field’s name. Here are both the sample xaml style and the converter code I have used to get red summaries for the “name” Field and blue for the “sales” Field:

     

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

        <Style.Triggers>

            <DataTrigger Binding="{Binding Converter={StaticResource MyFieldNameCon}}" Value="name">

                <Setter Property="Background" Value="Red" />

            </DataTrigger>

        </Style.Triggers>

        <Style.Triggers>

            <DataTrigger Binding="{Binding Converter={StaticResource MyFieldNameCon}}" Value="sales">

                <Setter Property="Background" Value="Blue" />

            </DataTrigger>

        </Style.Triggers>

    </Style>

     

    public class FieldNameConverter : IValueConverter

    {

        #region IValueConverter Members

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)

        {

            return (value as SummaryResult).SourceField.Label.ToString();

        }

            public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)

        {

            return value;

        }

        #endregion

    }

     

    Please let me know if you require any further assistance on the matter.

     

    Sincerely,

    Petar Monov

    Developer Support Engineer

    Infragistics Bulgaria

    www.infragistics.com/support

     

  • 27093
    posted

    Hello Patrick,

     

    I have been looking into your requirement and would like to forward you to another post in the forums where I have described how you can use a keyless Style with an IValueConverter to make it provide functionality only for one Field without affecting the others : http://forums.infragistics.com/forums/t/49449.aspx

     

    Hope this helps. Please let me know if you require any further assistance on the matter.

     

    Sincerely,

    Petar Monov

    Developer Support Engineer

    Infragistics Bulgaria

    www.infragistics.com/support