Skip to content

Infragistics Community Forum / Desktop / Ultimate UI for Windows Forms / Header Visible Position with columns and groups

Header Visible Position with columns and groups

New Discussion
hsn rhn
hsn rhn asked on Sep 15, 2016 8:15 AM

Hi

Suppose we have list of an object with 3 fields f1, f2 and f3. and I bind this list to grid with 

grid.DataSource = list.

I want grid shows the list in following orders:

f1,

f2 and f3 under a group (e.g, g1)

but my problem is "g1" group comes at first, and no matter how I set visible position,

I set visible position as this:

Columns["f1"].Header.VisiblePosition = 0;

Groups["g1"].Header.VisiblePosition = 1;

what can I do now?

thanks in advanced.

Sign In to post a reply

Replies

  • 0
    Michael Germann
    Michael Germann answered on Sep 14, 2016 4:15 PM

    Hi,

        If you are using groups, you shouldn't be using the VisiblePosition property. Instead of using the VisiblePosition, I suggest using the column.RowLayoutColumnInfo or the group.RowLayoutGroupInfo. Each of those have OriginX, OriginY, SpanX, SpanY which help with the position of the headers.

    Essentially when you are using groups you are using our RowLayout feature.  Which the designer does offer the ability to help you greatly with positioning. The link below is the landing page for that feature which has links for using the designer or not.

    http://help.infragistics.com/doc/WinForms?page=WinGrid_Row_Layouts.html

    If you would like to manual code then and not use the designer, another suggestion might be turn on Column and group moving, and possibly resizing. Then move and size them to how you want then just see what the OriginXResolved ,OriginYResolved, SpanXResolved, SpanYResolved are.

    private void UltraGrid1_InitializeLayout(object sender, InitializeLayoutEventArgs e)

    {

    e.Layout.Override.AllowRowLayoutColMoving = GridBagLayoutAllowMoving.AllowAll;

    e.Layout.Override.AllowGroupMoving = AllowGroupMoving.WithinBand;

    e.Layout.Override.AllowRowLayoutLabelSpanSizing = GridBagLayoutAllowSpanSizing.AllowAll;

    }

    Let me know if this helps,

    • 0
      hsn rhn
      hsn rhn answered on Sep 14, 2016 4:45 PM

      Thank you so much. I will try this and let you know the result.

    • 0
      hsn rhn
      hsn rhn answered on Sep 15, 2016 8:15 AM

      Thanks a lot. It worked like a charm!!. I set positions using OriginX for every column or group

      <code>

            var g1 =  grid.DisplayLayout.Bands[0].Groups.Add("g1", "group");

            var col = grid.DisplayLayout.Bands[0].Columns;

            var grp = grid.DisplayLayout.Bands[0].Groups; 

            col["f2"].RowLayoutColumnInfo.ParentGroup = g1;

            col["f3"].RowLayoutColumnInfo.ParentGroup = g1;

            col["f1"].RowLayoutColumnInfo.OriginX = 0;

            grp["g1"].RowLayoutGroupInfo.OriginX = 2;

            col["f2"].RowLayoutColumnInfo.OriginX = 0;

            col["f3"].RowLayoutColumnInfo.OriginX = 2;

      </code>

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
hsn rhn
Favorites
0
Replies
3
Created On
Sep 15, 2016
Last Post
10 years ago

Suggested Discussions

Tags

Created by

Created on

Sep 15, 2016 8:15 AM

Last activity on

Sep 15, 2016 8:15 AM