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
745
To display Group description in summarized row also
posted

  • 745
    posted in reply to [Infragistics] Boris Toromanov

    I have sorted out that issue thanks for your try

    Below i have posted one pic.My need to to hide that zero value .can u help me

  • 71886
    Offline posted

    Hello,

    I am checking about the progress of this issue. Please let me know If you need any further assistance on this.

  • 469350
    Suggested Answer
    Offline posted

    Hi,

    You would have to use a CreationFilter to do this.But it will be pretty tricky.

    First, you will need to create summary and align it to the "Classification column". This is just so you have a TextUIElement in the summary area so you can put your own custom text in it.

    But, you don't want this summary to display in the GroupByRow, so you need to set it up so it only displays at the bottom.


            private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
            {
                UltraGridLayout layout = e.Layout;
                UltraGridBand band = layout.Bands[0];
                UltraGridOverride ov = layout.Override;

                layout.ViewStyleBand = ViewStyleBand.OutlookGroupBy;
                band.SortedColumns.Add("Tool #", false, true);
                ov.GroupBySummaryDisplayStyle = GroupBySummaryDisplayStyle.SummaryCells;

                UltraGridColumn classificationColumn = band.Columns["Classification"];
                SummarySettings summarySettings = band.Summaries.Add("GroupByDescriptionSummary", SummaryType.Count, classificationColumn);
                summarySettings.SummaryDisplayArea = SummaryDisplayAreas.Bottom;
            }

    So now you have a summary which shows the count, but not the GroupByRow value like you want. That's where the CreationFilter comes in.


        public class GroupByDescriptionSummaryCreationFilter : IUIElementCreationFilter
        {
            #region IUIElementCreationFilter Members

            void IUIElementCreationFilter.AfterCreateChildElements(UIElement parent)
            {
                // Do nothing
            }

            bool IUIElementCreationFilter.BeforeCreateChildElements(UIElement parent)
            {
                // Watch for a TextUIElement
                TextUIElement textUIElement = parent as TextUIElement;
                if (parent is TextUIElement)
                {
                    // Try to get a SummaryValue from the TextUIElement.
                    SummaryValue summaryValue = parent.GetContext(typeof(SummaryValue)) as SummaryValue;
                    if (summaryValue != null)
                    {
                        // We got one, not make sure it's the right one.
                        if (summaryValue.Key == "GroupByDescriptionSummary")
                        {
                            // It is the right one. So now get the GroupByRow that is the parent of the
                            // summariy's rows collection.
                            UltraGridGroupByRow groupByRow = summaryValue.ParentRows.ParentRow as UltraGridGroupByRow;
                            if (null != groupByRow)
                            {
                                // Change the summary text to the GroupByRow's value.
                                textUIElement.Text = groupByRow.Value.ToString();
                            }
                        }
                    }
                }

                return false;
            }

            #endregion
        }