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
355
Show SummaryRecord background and brush color only till data
posted

Hi,

I am using XamDataGrid in my application and using SummaryDefinition to show summary information like Sum, Average etc as part of that. Background color and brush color of Summary Record spans over the entire width of grid but I want to limit that only till data area.
I have attached the screenshot for better understanding. As highlighted in the screenshot, I want to show background color only till end of Column "Q1_Col_4".

Please provide me a sample to refer.

Thanks,
Mahadev

Parents
No Data
Reply
  • 35319
    posted

    Hello Mahaved,

     

    Thank you for your post. I have been looking into your requirement and in order to achieve the desired functionality you could use a  keyless Style that would apply to all SummaryResultPresenters 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="Capacity">

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

                        <Setter Property="Foreground" Value="Green" />

                    </DataTrigger>

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

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

                        <Setter Property="Foreground" Value="SeaGreen" />

                    </DataTrigger>

                </Style.Triggers>

            </Style>

     

     

    public class MyConverter : IValueConverter

        {

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

            {

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

            }

     

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

            {

                return value;

            }

        }

     

    I am attaching a sample application(DataGridSummaryDefinitions.zip) that shows this approach.

     

    Let me know, if you need any further assistance on this matter.

    DataGridSummaryDefinitions.zip
Children