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
260
Expanded Area in GroupByRecord
posted

Hi,

How can I retemplate ExpandArea in GroupBy Record? I wato to add space between GroupBy records when they are expanded. I already set top space (space 1) by Resizing Top Border in GroupByRecordPresenter but have problem with bottom space ( space 2).

GroupByRecordPresenter template comtain only ExpansionIndicator, and Descryption. Cannot find template where is ItemPanel with expanded items so I can put space under it.

Any sugestions?

Parents
No Data
Reply
  • 16495
    Offline posted

    Hello,

    Unfortunately  the area you want to re-template is not part of GroupByRecordPresenter and in order to add the margin you mentioned and achieve similar behavior as from the attached image, I suggest to handle RecordExpanded and RecordCollapsed events of XamDataGrid.

    You can get the current expanded(collapsed) record from EventArguments and set the Margin you wish for record above and below it. It’s easy to find those records  if using GridViewPanelFlat. ChildElements collection: 


    private void xdg_RecordExpanded(object sender, Infragistics.Windows.DataPresenter.Events.RecordExpandedEventArgs e)
    {
        GroupByRecord groupRecord = e.Record as GroupByRecord;
        if (null != groupRecord && groupRecord.IsExpanded)
        {
            GroupByRecordPresenter groupRecordPresenter = (GroupByRecordPresenter)GroupByRecordPresenter.FromRecord(groupRecord);
            foreach (var item in (groupRecordPresenter.Parent as GridViewPanelFlat).ChildElements)
            {
                if ((item.GetType() == typeof(GroupByRecordPresenter) && (item as GroupByRecordPresenter).Record.Index == groupRecordPresenter.Record.Index - 1)) //presenter above
                    (item as GroupByRecordPresenter).Margin = new Thickness(0, 0, 0, 15);
                else if ((item.GetType() == typeof(GroupByRecordPresenter) && (item as GroupByRecordPresenter).Record.Index == groupRecordPresenter.Record.Index + 1)) //presenter below
                    (item as GroupByRecordPresenter).Margin = new Thickness(0, 15, 0, 0);
            }
        }
    }


    private void xdg_RecordCollapsed(object sender, Infragistics.Windows.DataPresenter.Events.RecordCollapsedEventArgs e)
    {
        GroupByRecord groupRecord = e.Record as GroupByRecord;
        GroupByRecordPresenter groupRecordPresenter = (GroupByRecordPresenter)GroupByRecordPresenter.FromRecord(groupRecord);
        foreach (var item in (groupRecordPresenter.Parent as GridViewPanelFlat).ChildElements)
        {
            if (item.GetType() == typeof(GroupByRecordPresenter)) //presenter above
                (item as GroupByRecordPresenter).Margin = new Thickness(0, 0, 0, 2);
        }
    }

    I have attached simple sample application, where you can test the suggested approach.

    Please let me know if you have any questions regarding this matter.

    Sincerely,
    Zhivko
    Entry Level Software Developer

    ExpandedGroupByREcordArea.zip
Children
No Data